I have a code which when run generates a table in swing form which contains a set of checkboxes which can be selected or unselected
When I click on the Check All ta
You are casting the source of the event to a JTableHeader:
JTableHeader header = (JTableHeader) (e.getSource());
and the source is a JTable when you click at a cell. I would have two different listeners for the header and the cell selection or you can do a hack by checking event.getSource() instanceof ... in your mouse-click-listener.
On line 152: JTableHeader header = (JTableHeader)(e.getSource()); you are assuming the event is on the table header. You need to check event source's class to see if it's on the header or an individual checkbox.