Search code examples
javaswingjcheckbox

Check whether the jcheckbox is selected in a table cells in Java SE


I want to the check the selected check boxes in a table cell after pressing a button and the that selected rows. (The table date will be filled by a DB - Mysql) Please explain me how to do that with examples.


Solution

  • The table's TableModel should have a column keeping booleans. getColumnClass() for the column should return Boolean.class. Then checkbox will be shown by DefaultTableCellRenderer. To get value just use table.getModel().getValueAt(...)