I have a problem to get value of checkbox from jtable in java, that is when i get value by this code "table.getvalue(0,1)" then i can not get the right value.
Asked
Active
Viewed 7,684 times
3 Answers
3
returns value from
JTable
containsJCheckBox
representsBoolean
value,toString
returns"true" / "false"
more in the JTable tutorial

mKorbel
- 109,525
- 20
- 134
- 319
3
JTable get cehckbox value when check box is checked:-
table.getModel().addTableModelListener(new TableModelListener() {
@Override
public void tableChanged(TableModelEvent e) {
for(int i=0;i<table.getModel().getRowCount();i++)
{
if ((Boolean) table.getModel().getValueAt(i,0))
{
System.out.println(">\t"+table.getSelectedRow());
break;
}
}
}
});

Krishnakant Kadam
- 3,225
- 1
- 14
- 9