Look at the methods convertRowIndexToModel()
and convertRowIndexToView()
in JTable.
When the table is sorted, the indices of the rows in the view don't match with the indices in the model anymore, and you have to use the above methods to convert from index to view and vice-versa.
For example, if you call JTable.getSelectedRow()
, you'll get the view index of the selected row. You'll have to convert it to the model index (using convertRowIndexToModel()
) to be able to get the selected object from the list in your model.