I have JTable and I fill it with SQL data, here is my method:
private void updateTable() {
try {
String sql = "SELECT number as Numver, name as Available, type FROM available_t ORDER BY number asc";
pst = conn.prepareStatement(sql);
rs = pst.executeQuery();
tableAvail.setModel(DbUtils.resultSetToTableModel(rs));
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
} finally {
try {
rs.close();
pst.close();
} catch (Exception e) {
}
}
}
So far so good. The data shows correct. But, I want to put one more column with checkbox. When I try to create manually using wizard in Eclipse (button 'model') I can't add new column, maybe because the table and columns is create by method. So, How I can add new column, that will have checkboxes. Then after I select some checkbox - when I press OK button, to check which checkboxes are checked and update it in db in column TYPE with YES or NO.
Aucun commentaire:
Enregistrer un commentaire