Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

is it possible to allow only one check among all checkbox in JTable

 
sophie lee
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
i did a jTable out and in it i have this column which is boolean type, this column display the checkbox.

Expected output:
user can only enable to check one of the checkbox in many rows from the jTable

What i have so far:
user can check multiple check box

Thanks
Hope someone can clear my doubt as soon as possible
 
K. Tsang
Bartender
Posts: 3441
13
Android Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Checkboxes are meant for multiple selection. For single selection better to use radio buttons.
 
Maneesh Godbole
Saloon Keeper
Posts: 11027
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.
You can override the setValueAt method and deselect existing choice (setting the value to false) before setting the new value to true.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic