1. I know the answer.
2. The turorial has an example how to sort table columns.
3. If that's not what you need then you need to give more details in your question, because it's not very clear.
4. Lean how to search in google: http://www.google.com/search?sourceid=navclient&ie=UTF-8&rls=GGLD,GGLD:2004-11,GGLD:en&q=jtable+sort
5. No help for you.
I don't want to interfere the education process here. but, I took the same algorithm and it works fine for numbers.
Make sure that the sorter gets int data from you data model.
you can see that basically it compares objects, so make sure that the objects that get compared are actually numbers.
> I have read the tutorial.
Where in your question do you state that. Are we suppposed to be mind readers.
> If you don't know the answer please do not reply!!!
Based on the information given it was the most apppriate reply.
> I can sort the name column, the number column can't give me 1,2,3,4,5,6 it gives me 1,2,5,3,4,6.
Where in your original question did you state you could sort Strings but not Integers?
> I don't know what data model is being used here, and I'm not going to guess.
I don't blame you. Usually a problem like this is caused because the table is treating the Integers like a String (because the OP didn't tell the table that the column contains Integers). But since all the OPs data is single digit integers it should make a difference if the data is sorted as a String. So who knows whats wrong.
Of course the OP probably just made up the sort data and that is not really what is happening.
> I don't blame you. Usually a problem like this is
> caused because the table is treating the Integers
> like a String (because the OP didn't tell the table
> that the column contains Integers). But since all the
> OPs data is single digit integers it should make a
> difference if the data is sorted as a String. So who
> knows whats wrong.
I know, the default for TableSorter is Alphabetic comparator.
So from the numbers given I can't even guess what is the problem.
Also note that you can use a TableSorter without a JTable to sort various tablemodels that you may use (I use tableModels for everything).
TableSorter ts = (TableSorter) dbsys.createTableModel("conn", al, true);
ts.setSortingStatus(1, 1); //sort by company
ts.setSortingStatus(3, 1); //sort by last name
ReportModel rm = new ReportModel (ts); //converts everything to strings and provides an easy mechanism for iterating and accessing the data
Sean