I have a table with 3 column and dynamic row based from database value and a jcheckbox in last column based on this code :
TableColumn tcolumn = tabel.getColumnModel().getColumn(2);
tcolumn.setCellRenderer(tabel.getDefaultRenderer(Boolean.class));
tcolumn.setCellEditor(tabel.getDefaultEditor(Boolean.class));
example of my table:
============================================
val 1 || val 2 || val 3 (checkbox) ||
============================================
from FB || from DB || checkbox ||
from DB || from DB || checkbox ||
===========================================
My question is simple, how can I get all of the value 1 from the ticked checkbox in column 2 (value 3)?
I tried many simple code but still got an error.
this is my code:
for (int row =0; row <= tabel.getSelectedRowCount(); row++) {
Boolean b = ((Boolean) tblModel.getValueAt(row, 2));
if (b.booleanValue()) {
System.out.print(tblModel.getValueAt(row, 0)+" || ");
}
}