I have a JTable that uses a DefaultTableModel and I allow for sorting when the user clicks on the column headers. However, when the user clicks on a header for a column that
Here is the answer: Problems with JTable sorting of integer values
The idea is to define classes for columns.
myTable.setModel(new DefaultTableModel(Object[][] tableData, String[] columnsNames){
Class[] types = { Boolean.class, Boolean.class, String.class, String.class };
@Override
public Class getColumnClass(int columnIndex) {
return this.types[columnIndex];
}
});