aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes is it possible to allow only one check among all checkbox in JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "is it possible to allow only one check among all checkbox in JTable" Watch "is it possible to allow only one check among all checkbox in JTable" New topic
Author

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

sophie lee
Greenhorn

Joined: Sep 30, 2013
Posts: 1
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

Joined: Sep 13, 2007
Posts: 2416
    
    7

Checkboxes are meant for multiple selection. For single selection better to use radio buttons.


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10375
    
    8

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.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: is it possible to allow only one check among all checkbox in JTable