如何对 JTable 中的无符号数进行排序 (JAVA)

How to sort unsigned numbers in JTable (JAVA)

得到的数字的值为字符串。由于这个原因,它不能在 JTable 中作为数字排序。有什么办法可以解决这个问题。

注意:我使用的是自定义 table 模型,但如果插入的值是字符串,排序会将其作为字符串排序,而不管列 class 设置如何。

Integer.toUnsignedString(number);
Class[] types={String.class,String.class,Integer.class,Integer.class};

也许有一些使用 TableRowSorter 的解决方案 class。

问题已通过 RowSorter 和 Comparator 解决类。