aspose file tools*
The moose likes JDBC 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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "TableSorter class" Watch "TableSorter class" New topic
Author

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.
table.getTableHeader().setToolTipText(
"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.
add(scrollPane);
}


thanks very much
Zohreh
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321




have you compiled your TableSorter.java 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 TableSorterDemo.java file ?
[ October 11, 2006: Message edited by: Saif Uddin ]

Saifuddin..
[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
 
 
subject: TableSorter class