• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Clickable jtable header?

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic