Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setting up JCheckBox in JTable

 
Alan Shiers
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2580
9
  • Likes 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic