This week's giveaway is in the Spring forum.
We're giving away four copies of Microservices Testing (Live Project) and have Chris Love & Andres Sacco on-line!
See this thread for details.
Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Adding checkbox to some selected row of a column.

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 22662
127
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic