This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
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 Building Microservices this week in the Design 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: 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.

Alan

Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2373
    
    8
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.
 
Have you checked out Aspose?
 
subject: setting up JCheckBox in JTable
 
It's not a secret anymore!