File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes TableSorter class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Customer Requirements for Developers this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "TableSorter class" Watch "TableSorter class" New topic

TableSorter class

zohreh talebi
Ranch Hand

Joined: Sep 01, 2006
Posts: 41
I want to sort a table and use TableSorter class.
This part of code that i use TableSorter class.the problem is , my class don't know object of this class . How can i import this class?

public TableSorterDemo() {
super(new GridLayout(1,0));

TableSorter sorter = new TableSorter(new MyTableModel()); //ADDED THIS
//JTable table = new JTable(new MyTableModel()); //OLD
JTable table = new JTable(sorter); //NEW
sorter.setTableHeader(table.getTableHeader()); //ADDED THIS
table.setPreferredScrollableViewportSize(new Dimension(500, 70));

//Set up tool tips for column headers.
"Click to specify sorting; Control-Click to specify secondary sorting");

//Create the scroll pane and add the table to it.
JScrollPane scrollPane = new JScrollPane(table);

//Add the scroll pane to this panel.

thanks very much
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

have you compiled your file or not ?

If Yes so where you replace you tableSorter.class file (I mean in which folder). Is it in the same folder where you compiling your file ?
[ October 11, 2006: Message edited by: Saif Uddin ]

[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
I agree. Here's the link:
subject: TableSorter class
It's not a secret anymore!