From 5d80a3a167cd20d266ba4e73745aba47ae1dea79 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Mon, 30 May 2022 15:05:06 +0200 Subject: [PATCH] Clean up on aisle 5 --- .../sf/openrocket/gui/main/SimulationPanel.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/swing/src/net/sf/openrocket/gui/main/SimulationPanel.java b/swing/src/net/sf/openrocket/gui/main/SimulationPanel.java index a2a346caa..15f775d3b 100644 --- a/swing/src/net/sf/openrocket/gui/main/SimulationPanel.java +++ b/swing/src/net/sf/openrocket/gui/main/SimulationPanel.java @@ -464,11 +464,12 @@ public class SimulationPanel extends JPanel { simulationTable.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { + int selectedRow = simulationTable.getSelectedRow(); + if (selectedRow < 0) { + return; + } + if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) { - int selectedRow = simulationTable.getSelectedRow(); - if (selectedRow < 0) { - return; - } int selected = simulationTable.convertRowIndexToModel(selectedRow); int column = simulationTable.columnAtPoint(e.getPoint()); @@ -481,11 +482,7 @@ public class SimulationPanel extends JPanel { openDialog(document.getSimulations().get(selected)); } - } else if (e.getButton() == MouseEvent.BUTTON3 && e.getClickCount() == 1){ - int selectedRow = simulationTable.getSelectedRow(); - if (selectedRow < 0) { - return; - } + } else if (e.getButton() == MouseEvent.BUTTON3 && e.getClickCount() == 1) { doPopup(e); } }