Reputation: 2070
i have a jtable with a checkbox in the header and other checkbox in the cell of the column.
like you can see on the picture, there are a problem
boolean is used for the first colum for the DefaultTableModel
right now, i have a tableRenderer for my first column
what option should i use to make header to get deselected if a check box is deselected?
thanks
Upvotes: 1
Views: 3282
Reputation: 857
That would be very easy. Register a listener to the table model:
table.getModel().addTableModelListener(listener);
Look at the event, if the value changed was from the first column and it was set to false then deselect the checkbox.
Upvotes: 0
Reputation: 6867
Have an actionevent for the top checkbox, and on checked or unchecked, run a for loop to check/uncheck all the checkboxes in the table.
Upvotes: 1