Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

JTable - Sorting rows

 
Bartender
Posts: 1752
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JTable where a thread populates it with directory information.
I then want to sort it on any of the columns.
I've implemented the SortFilterModel class (that extends AbstractTableModel) technique discussed in Core Java, Volume II.
But the example in this book (Ch 6, advanced Swing) assumes you have the model populated first and you then it immediately creates a SortFilterModel object based on the already-populated DefaultTableModel (that is, after using the constructors from the up-front created arrays).
In my case, I have a set of directories loaded into a JList first that I THEN want to sort.
However, I can't seem to get the display to change to show that rows based on column clicked are now sorted.
I can post code, but it's fairly long.
Has anybody run into this kind of thing before?
Thanks much.
-- Mike
 
Mike London
Bartender
Posts: 1752
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks much for your reply. <s>
 
I'm gonna teach you a lesson! Start by looking at this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic