I have a JTable, that has one column that is text which is not editable and the second column is a check box that displays boolean values.... Now what i want is, when the us
You can get the selection interval with code similar to this:
table.getSelectionModel().addListSelectionListener(new ListSelectionListener(){
public void valueChanged(ListSelectionEvent e) {
minSelectedRow = ((DefaultListSelectionModel)e.getSource()).getMinSelectionIndex();
maxSelectedRow = ((DefaultListSelectionModel)e.getSource()).getMaxSelectionIndex();
}
});
Then, when one checkbox is checked (listen to ItemEvent
) you should iterate from the minSelectedRow
to the maxSelectedRow
and change checked boxes state. That's it.