How to preserve table row selecetion after table mode update (fireTableDataChanes)? I know that I should save selection before fire and restore it after (from there). But when I try to restore selection in TableModelListener it doesn’t work. So where should I restore selection?
Update:
Now I try to restore selection in this way:
table.setModel(model);
model.addTableModelListener(new TableModelListener() {
@Override
public void tableChanged(TableModelEvent e) {
table.addRowSelectionInterval(1, 1);
}
});
but it doesn’t work.
Decision is simple: we should use Swing EventQueue: