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

Please Help me JCheckBox in JTable

 
Rohit Kedia
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
Please help me out ... I need how to add a Jcheckbox in a JTable column.
I tried to add but the checkbox was not getting checked or set.

Please help
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
did you read Sun's JTable tutorial? (it contains a checkbox column)
 
Rohit Kedia
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey thanks for the Reply,
I have read it .. but found it difficult to implement.

In my Table I am getting the Check box by adding the method



but the problem is my that check box is not getting checked after loading the Table and neither it is getting checked on clicking on the Check box please help.
 
Rob Spoor
Sheriff
Pie
Posts: 20527
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should also override setValueAt so that the return value of getValueAt for that cell will return false. In other words, if before Variable a != Y for that row, then you should change your model's data such that Variable a == Y afterwards. Otherwise the model will still return Boolean.FALSE for that cell and the check box will remain unchecked.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> but the problem is my that check box is not getting checked after loading the Table and neither it is getting checked on clicking on the Check box please help.

the main problem, for me, is that you've decided to post your problem in multiple forums,

http://www.java-forums.org/awt-swing/28154-jcheckbox-jtable-column.html

and I have absolutley no intention of spending one more second of my time trying to resolve your problem here,
when the problem may have been already resolved on other forum/s
 
Rob Spoor
Sheriff
Pie
Posts: 20527
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael refers to Be Forthright When Cross Posting To Other Sites.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic