jQuery in Action, 3rd edition
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
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "setting up JCheckBox in JTable" Watch "setting up JCheckBox in JTable" New topic

setting up JCheckBox in JTable

Alan Shiers
Ranch Hand

Joined: Sep 24, 2003
Posts: 237
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.


Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2447
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
It's not a secret anymore!