Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JTable with CheckBox

843805Oct 21 2005 — edited Oct 22 2005
Hello,

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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 19 2005
Added on Oct 21 2005
4 comments
584 views