I have a problem with sorting primitive long in JTable. I have a class, this class extends AbstractTableModel and overrides method getColumnClass, here is the code of this method:
public Class<?> getColumnClass(int columnIndex) {
return columnFields[columnIndex].getType();
}
So, this method uses reflection api for getting class type. And I notice, that, if I change in my class(which stored in this tablemodel) type from long on Long, sorting will work correct. But if I use long instead Long, jtable interpreters this value as a string and sorting it as a string. Notice: columnFields is array of fields of the stored class. What is this? How to fix it? How to make this working for any type long or Long?
Aucun commentaire:
Enregistrer un commentaire