Issue
By default, the selection of rows in a JTable
uses view index. View index-based selection means that selection of rows in a table is associated with the row number instead of the actual data that is selected. Is there any way to change this so that selection is based on the model so that the data I select is associated with the selection?
Solution
You probably can't change the behaviour, but you can use some of JTable
s methods to convert between the two:
int convertColumnIndexToModel(int viewColumnIndex)
int convertColumnIndexToView(int modelColumnIndex)
int convertRowIndexToModel(int viewRowIndex)
int convertRowIndexToView(int modelRowIndex)
Answered By - Rob Spoor
Answer Checked By - Timothy Miller (JavaFixing Admin)