1

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 enter image description here

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

4

2 回答 2

1

为顶部复选框设置一个 actionevent,并在选中或取消选中时,运行 for 循环来选中/取消选中表中的所有复选框。

于 2011-06-13T16:50:28.487 回答
0

那将非常容易。向表模型注册一个监听器:

table.getModel().addTableModelListener(listener);

查看事件,如果更改的值来自第一列并且设置为 false,则取消选中该复选框。

于 2011-08-06T06:20:26.197 回答