It is messing up when it tries to sort my columns that have integers
Probably because:
- You are storing the numbers as Strings, or
- You are storing the data as an Integer object but you didn't override the
getColumnClass()
method of your TableModel to returnInteger.class
for that column. The proper Comparator will only be used when your column class is correct.
See the section from the Swing tutorial on Concepts: Renderers and Editors for more information and an example of how you might override the getColumnClass() method.