JTable with CheckBox
843805Oct 21 2005 — edited Oct 22 2005Hello,
I have a set of user defined value objects stored in Vector. The values in the vector are represented as JTable using TableModel. I need to add first column of table as checkbox. This checkbox is used to represent row selection by user. So, I have used Boolean class for that and it is displaying checkBox as Jtable by default shows checkBox for Boolean value. But I couldnot edit it even though isCellEditable returns true for column 1.
Also, I have to detect the change in checkbox values. This table contains hundred of rows. I need to detect the checkbox values and find the selected rows.
Since checkbox column is not part of value object how do I set and get the values of checkBoxes. Can this be done?
Do I need to add a new member variable to valueobject and use this to represent checkbox column.
Also, is it better to use a CheckBoxRender as TableCellRender?.
Please share your views.
Thanks.