File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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: 19653
    
  18

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


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JTable header click event ?
 
Similar Threads
How to properly read the custom Header value in the E-mail envolope
how to delete a row header
Adding custom Header information to the HttpServletRequest object
WA #1.....word association
Printing company information with table