This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes check box in the JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "check box in the JTable" Watch "check box in the JTable" New topic

check box in the JTable

anand narasimha

Joined: Jan 30, 2007
Posts: 1
What is the method called when the JCheckbox is selected in the JTable having a TableModel?
In my case i am able to uncheck the checkbox and not able check the checkbox
[ January 30, 2007: Message edited by: anand raghavendra ]
Mathias Nilsson
Ranch Hand

Joined: Aug 21, 2004
Posts: 367
I think you need to do this in the renderer because the state
of the checkbox is not preserved.

Try extending the DefaultTableCellRenderer class and implement the getTableCellRendererComponent method and create your own renderer.

// MAthias

Brian Cole
Ranch Hand

Joined: Sep 20, 2005
Posts: 862
Originally posted by anand raghavendra:
In my case i am able to uncheck the checkbox and not able check the checkbox

Does your table model return true in isCellEditable() for the cells in question?

If so, the next thing to check is that setValueAt() handles Boolean values correctly for those cells.

bitguru blog
wood burning stoves
subject: check box in the JTable
Similar Threads
rendering the jcheckbox in jtable
JTable and JCheckboxes
Select All checkbox in Jtable
Checkbox editor for JTable column