Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sorting a JTable

Status
Not open for further replies.

CaptRage61

Programmer
Feb 17, 2005
50
US
Does anyone know how to sort a JTable? I have a table with a column of strings, one of ints and one of doubles. I need to be able to sort them by columns.
 
Thanks that helped, I had that link too but I guess I missed that part.

I do have a problem with that though, Here is what it says:

TableSorter sorter = new TableSorter(new MyTableModel());
JTable table = new JTable(sorter);
sorter.setTableHeader(table.getTableHeader());

On the first line TableSorter does not have any constructors to take a modle as input, or any methods to do this either. How do I create a new tableModel then??
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top