• 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

Sort JTable Data on Column Header Click

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
Im trying to sort a jTable on column click, but when I insert the mouse click event; my panel is not updating with sorted table.

I used sorting algo in a separated class and code is working properly if I remove the header click event and uncomment other stuffs in bottom



thanks in advance !
 
Ranch Hand
Posts: 4632
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
> my panel is not updating with sorted table.

actually, it is - you can't see it because 'panel' is a FlowLayout.
run the program, click a header, now drag the frame real wide (so there's enough space to show the 2 tables)

you can either
change 'panel' to a more suitable LayoutManager, or better
change the model of the visible table (instead of creating another table)
 
Hewa Naimanage Sumedha Amalka
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It worked... thanks Michael...
reply
    Bookmark Topic Watch Topic
  • New Topic