Hi,
I have a JTable
(extended) and an implementation of TableModel
, in which I have the methods ...
moveEntryUp(int rowIdx)
moveEntryDown(int rowIdx)
... within the table model implementation. I have verified that these work properly.
However, I am having problems in getting the changes made in the table model to propagate to the actual JTable
. In this table I only allow single row selection, and have seperate button for Up and Down. When a row is elected, I need to be able to move that row up and down, and preserve the selection.
E.g.
If my rows are [A, B, C(selected)]
, and I press the up button,
I should get [A, C(selected), B]
.
The various approaches I have tried so far either fail to refresh the values in the JTable, or lose the selection.
NOTE:
I am hesitant to use a solution which requires an explicit call to repaint()
.
Assume that all cells in the JTable
are not editable.