aspose file tools*
The moose likes Java in General and the fly likes Clickable jtable header? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Clickable jtable header?" Watch "Clickable jtable header?" New topic
Author

Clickable jtable header?

Kevin Hamrick
Ranch Hand

Joined: Aug 30, 2004
Posts: 32
So the situation is this. I build a jtable dynamically from data I grabbed out of a database. Now I want to have the header tags do a sort(sorting being another problem) when a column is clicked. I do not know how to tell which column is clicked. Here is the snippet of code which I was working on for the eventListener

The print statement returns -1 each time which means that none of the 9 columns were selected. Not sure how to do this. Please help and thanks.
Petr Blahos
Ranch Hand

Joined: Apr 28, 2004
Posts: 131
I think this topic is very nicely covered in:
http://java.sun.com/docs/books/tutorial/uiswing/components/table.html
http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#sorting

BTW, we have a forum here, which is called Swing/AWT/SWT/JFace.

P.


Get a better web browser:<br /><a href="http://www.mozilla.org/products/firefox/switch.html" target="_blank" rel="nofollow">http://www.mozilla.org/products/firefox/switch.html</a>
 
jQuery in Action, 2nd edition
 
subject: Clickable jtable header?