• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Adding checkbox to some selected row of a column.

 
Rajesh k Jha
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am having an issue related to checkbox in JTable. Although i searched it in the forum, but solution was not there and no relevant suggestion found.

1. I want to add checkbox in some selected row, i.e I have a JTable with 3 column , 1st column is checkbox, second is String and third is value like 1,2,2,1,2.

Now I want to show checkbox (In First column )only in rows where there is value of 1 against it in column 3rd.
My value in table is added dynamically using collection.



Although I am able to mark it not editable using following code


But what i want is checkBox either be showing dimmed or not visible for this particular value (1) in the 3rd column.

Help would be appreciated as its urgent..
Thanks in advance.
 
Rob Spoor
Sheriff
Pie
Posts: 20613
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The cell renderer must display the check box differently. This means you cannot use the default boolean cell renderer. Fortunately you can wrap it:
Combined with the model's isCellEditable method as you have it this should work.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic