This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JTableHeader column selection 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 "JTableHeader column selection" Watch "JTableHeader column selection" New topic
Author

JTableHeader column selection

Greg Keene
Greenhorn

Joined: Apr 17, 2004
Posts: 3
Here is a snippet that I am using to catch which column header is being selected.


The problem is when the user wants to resize the column width. Since Microsoft Excel allows the user to double-click between the columns to resize, if the user tries this the mouse listener is being triggered and the column is being sorted (but not resized).

Any idea on how I can determine if the mouse is being held between two columns (cursor changes to <--> instead of the default cursor)?
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
This seems to work okay.
Greg Keene
Greenhorn

Joined: Apr 17, 2004
Posts: 3
perfect...I never thought about consuming the event...and I really never thought about checking for the cursor type.

thank you.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JTableHeader column selection
 
Similar Threads
Adding Tooltip to JTable header
JTableHeader Problem
Resize column width for JTable with headers?
Jtable mouse header cursor
Problem with JTable