aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes setting up JCheckBox in JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "setting up JCheckBox in JTable" Watch "setting up JCheckBox in JTable" New topic
Author

setting up JCheckBox in JTable

Alan Shiers
Ranch Hand

Joined: Sep 24, 2003
Posts: 236
Hi there,

I'm setting up a column in JTable that contains JCheckBoxes. I use the following renderer and editor to achieve this. It all works fine except when I click on a cell containing a JCheckBox, which initially appears centered in the cell, it suddenly moves to the left of the cell. I'd like it to stay where it is. Please advise.

Alan

Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2090
    
    7
There is no need to create a custom render and editor. JTable provides default implementations for this. Just override the getColumnClass(....) method to return Boolean for that column and the default renderer/editor will be used.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: setting up JCheckBox in JTable
 
Similar Threads
Table with CheckBoxes in JScrollpane
JCheckBox in JTable
putting multiple checkboxes on a JTable cell
Cannot uncheck JCheckBox in JTable
Adding a column of JRadioButtons to a JTable