wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Check Box in JTable header Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Check Box in JTable header" Watch "Check Box in JTable header" New topic
Author

Check Box in JTable header

Mythily Jaganathan
Greenhorn

Joined: Aug 22, 2006
Posts: 19
Hi All,

I have a problem in JTable With check box.

The rows can have the checkboxes, but what about the Checkbox in header?

When the Check box in header is selected, all the Check boxes in that column should be selected. i.e., it should act as select all.

Please help me!

Thanks
Mythily
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
adapted from here

http://www.codeguru.com/java/articles/664.shtml


Mythily Jaganathan
Greenhorn

Joined: Aug 22, 2006
Posts: 19
Hi Michael,
That was wonderful solution.
Thanks a lot.

Mythily
Sham Phadtale
Ranch Hand

Joined: Jul 29, 2008
Posts: 75
Does java provide default checkbox renderer for JTable Header, as it provide for JTable cell?
For ex. -


How to capture event generated by click on JTable header ? Is there any method in java which get called when click on JTable header, like setValueAt() get called in case of click on cell?

Is it possible to do above program without using custom renderer for JTable header?
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> How to capture event generated by click on JTable header ?

if there's nothing in the newer versions of java (assuming you've read the javadocs),
either read the posted code in this thread, or
look into the source code for JTable's rowSorter
Jordan Walker
Greenhorn

Joined: May 20, 2013
Posts: 1
Question.. I've looking at the code (Which helped a lot) But the only problem I've ran into is that when I take out the text in the JTable header... I think it says something like "setBorder(UIManager.getBorder("TableHeader.cellBorder"));" the jcheckbox appear pushed over into the corner is there away to fix this issues??
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Check Box in JTable header
 
Similar Threads
Row Highlight on a JTable
Problem in JTable row selection
Select All checkbox in Jtable
JTable
JCheckBox and JTable