I have created a jtable and at the last column I turned it to a Boolean.class turning the whole column into check boxes now what I want to do is get each each check boxes individually so I can create an if statement to remove rows but when I try I only get the first row or when I try to get the seconded check box I remove two rows instead on that row I have clicked on I tried model.getRowCount and table.getRowCount and its not working.
table.setModel(new DefaultTableModel(data, col)
{
public Class<?> getColumnClass(int column)
{
switch(column)
{
case 0:
return String.class;
case 1:
return String.class;
case 2:
return String.class;
case 3:
return String.class;
case 4:
return String.class;
case 5:
return String.class;
case 6:
return String.class;
case 7:
return String.class;
case 8:
return String.class;
case 9:
return String.class;
case 10:
return Boolean.class;
default:
return String.class;
}
}
});
The below statement is the only one that works. Is there a way to get the check boxes individually?
if(Boolean.TRUE)
{
Submit(0);
((DefaultTableModel)table.getModel()).removeRow(0);
}