wood burning stoves 2.0*
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable header click event ?" Watch "JTable header click event ?" New topic

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 ,

Rob Spoor

Joined: Oct 27, 2005
Posts: 19649

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

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 ?

I agree. Here's the link: http://aspose.com/file-tools
subject: JTable header click event ?
Similar Threads
Printing company information with table
How to properly read the custom Header value in the E-mail envolope
how to delete a row header
WA #1.....word association
Adding custom Header information to the HttpServletRequest object