We\'re seeing JTable
selection get cleared when we do a fireTableDataChanged()
or fireTableRowsUpdated()
from the TableModel
.
This is default behavior. If you call fireTableDataChanged()
the entire table is rebuild from scratch as you set entirely new model. In this case the selection is, naturally, lost. If you call fireTableRowsUpdated()
the selection is also cleared in general cases. The only way is to remember selection and then set this. Unfortunately there is no guarantee that the selection will be still valid. Be careful if restoring selection.