Fix sim table not taking proper spotlight
This commit is contained in:
parent
36e0cf2168
commit
a47e2f416e
@ -1404,21 +1404,26 @@ public class SimulationPanel extends JPanel {
|
||||
* Focus on the simulation table and maintain the previous row selection(s).
|
||||
*/
|
||||
public void takeTheSpotlight() {
|
||||
simulationTable.requestFocusInWindow();
|
||||
if (simulationTable.getRowCount() == 0 || simulationTable.getSelectedRows().length > 0) {
|
||||
return;
|
||||
}
|
||||
if (previousSelection == null || previousSelection.length == 0) {
|
||||
simulationTable.getSelectionModel().setSelectionInterval(0, 0);
|
||||
} else {
|
||||
simulationTable.clearSelection();
|
||||
for (int row : previousSelection) {
|
||||
if (row < 0 || row >= simulationTable.getRowCount()) {
|
||||
continue;
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
simulationTable.requestFocusInWindow();
|
||||
if (simulationTable.getRowCount() == 0 || simulationTable.getSelectedRows().length > 0) {
|
||||
return;
|
||||
}
|
||||
simulationTable.addRowSelectionInterval(row, row);
|
||||
if (previousSelection == null || previousSelection.length == 0) {
|
||||
simulationTable.getSelectionModel().setSelectionInterval(0, 0);
|
||||
} else {
|
||||
simulationTable.clearSelection();
|
||||
for (int row : previousSelection) {
|
||||
if (row < 0 || row >= simulationTable.getRowCount()) {
|
||||
continue;
|
||||
}
|
||||
simulationTable.addRowSelectionInterval(row, row);
|
||||
}
|
||||
}
|
||||
updateActions();
|
||||
}
|
||||
}
|
||||
updateActions();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user