I have JTable with name 'tableEarnings' it consist of 3 columns:
- check
- Earnings
- Description and a
- jButton
Every cell in 'check' column have a checkbox. I need to fetch checked values of 'Earnings' and 'Description' cell from JTable
and store it to a database when I click jButton
please help me
This my code for button listener:
private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {
//System.out.println("table"+tableEarnings.getModel().getRowCount());
for (int i = 0; i < tableEarnings.getModel().getRowCount()+1; i++) {
if ((Boolean) tableEarnings.getModel().getValueAt(i, 0)) {
System.out.println("Value" + tableEarnings.getValueAt(i, 1));
break;
}
}
}