Okay, I get it Zod is the bad guy. But is he an idiot? You take blue Kryptonite to make sure you don’t get sucked up to another world only to put it into your foe…and you get sucked up into that other world anyways? Wow! I kind of saw that coming, I won’t lie. Season 9 felt like a real slow burn for me. I like that about the older TV shows when we got more than twenty episodes a season! Talk about a wild ride. Season Nine did not disappoint. Now, onto Season Ten! The final and last season of Smallville.
Every once in a while we need to populate data in a JTable. Here's a simple to use DefaultTableModel for populating a JTable from a ResultSet.
public DefaultTableModel buildTableModel(ResultSet rs)
throws SQLException {
ResultSetMetaData metaData = rs.getMetaData();
Vector columnNames = new Vector<String>();
int columnCount = metaData.getColumnCount();
for (int column = 1; column <= columnCount; column++) {
columnNames.add(metaData.getColumnName(column));
}
Vector<Vector<Object>> data = new Vector<Vector<Object>>();
while (rs.next()) {
Vector<Object> vector = new Vector<Object>();
for (int columnIndex = 1; columnIndex <= columnCount; columnIndex++) {
vector.add(rs.getObject(columnIndex));
}
data.add(vector);
}
DefaultTableModel dtm = new DefaultTableModel(data, columnNames) {
private static final long serialVersionUID = 1L;
@Override
public boolean isCellEditable(int row, int column) {
//all cells false
return false;
}
};
return dtm;
}
Comments
Post a Comment