I imported javax.swing.table.TableRowSorter;
used it in the table model. It works properly with Strings, but with numbers it orders everything in a weird way, as shown in the picture. I'm a noob at coding so I don't really know how to properly google for such an issue yet.
DefaultTableModel model = new DefaultTableModel();
table.setAutoCreateRowSorter(true);
Not sure if you still need more code. It is a mess tbh, as object oriented coding came up in school after i started this.

Your problem is that your sorting is doing an alphabetical sort, which works well for
Stringobjects, but once you haveIntegersto sort, you will have the situation that 2 > 19, because alphabetically 2 is after 1.You will need something like:
where
datais anObject[][]andcolumnsis anObject[].