Remove redundant row query

This commit is contained in:
SiboVG 2022-11-17 17:34:59 +01:00
parent b42acb5416
commit 39100f76f6

View File

@ -208,13 +208,10 @@ public class SimulationPanel extends JPanel {
}
// Show context menu
else if (e.getButton() == MouseEvent.BUTTON3 && e.getClickCount() == 1) {
// Get the row that the right-click action happened on
int r = simulationTable.rowAtPoint(e.getPoint());
// Select new row
if (!simulationTable.isRowSelected(r)) {
if (r >= 0 && r < simulationTable.getRowCount()) {
simulationTable.setRowSelectionInterval(r, r);
if (!simulationTable.isRowSelected(row)) {
if (row >= 0 && row < simulationTable.getRowCount()) {
simulationTable.setRowSelectionInterval(row, row);
} else {
return;
}