Fix sim table keep selection after tab switch

This commit is contained in:
SiboVG 2022-07-30 00:51:51 +02:00
parent 485f1ad010
commit 687fb6f6e3

View File

@ -998,8 +998,14 @@ public class SimulationPanel extends JPanel {
*/
public void takeTheSpotlight() {
simulationTable.requestFocusInWindow();
if (simulationTable.getSelectedRowCount() == 0 && simulationTable.getRowCount() > 0) {
simulationTable.setRowSelectionInterval(0, 0);
int selection = simulationTable.getSelectionModel().getAnchorSelectionIndex();
if (selection == -1) {
if (simulationTable.getRowCount() > 0) {
selection = 0;
} else {
return;
}
}
simulationTable.setRowSelectionInterval(selection, selection);
}
}