This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes how to sort a JTable straight before displaying it Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how to sort a JTable straight before displaying it" Watch "how to sort a JTable straight before displaying it" New topic
Author

how to sort a JTable straight before displaying it

Albert Robert
Greenhorn

Joined: Dec 02, 2011
Posts: 10
how to sort a JTable straight before displaying it

by one column
its value is 1,2,3,4 ........

whether this is the only way?

http://www.exampledepot.com/egs/javax.swing.table/SortCol.html

how to make it easier
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
table.setAutoCreateRowSorter(true);
table.getRowSorter ().toggleSortOrder (0);

where '0' is the index of the column to be sorted
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to sort a JTable straight before displaying it
 
It's not a secret anymore!