Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes Swing / AWT / SWT and the fly likes JTable header click event ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Badass: Making Users Awesome this week in the Game Development forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable header click event ?" Watch "JTable header click event ?" New topic
Author

JTable header click event ?

Hesham Gneady
Ranch Hand

Joined: Feb 26, 2007
Posts: 66
Hi Ranchers ,

I wonder is there a way to detect the user clicking on the header of the table so i can execute some code if he did this ?

Thanks ,
Hesham


Hesham
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19947
    
  25

JTableHeader can have a MouseListener added just like almost any other control.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Hesham Gneady
Ranch Hand

Joined: Feb 26, 2007
Posts: 66
Thanks Rob ... actually what i was trying to do is do some action after i click on any column header to sort the table.

I thought after the mouseReleased() event for the JTableHeader click the table should have been sorted & i can do the action i want, but i found that the sorting happens after that event.

So is there a way i can detect the table sorting is finished ?

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTable header click event ?