From c7a824841be14b70bc903772ec5c8eabcfaa5f8f Mon Sep 17 00:00:00 2001 From: SiboVG Date: Fri, 3 Jun 2022 03:49:56 +0200 Subject: [PATCH] Move series selection in sim plot to the beginning --- .../gui/plot/SimulationPlotDialog.java | 45 +++++++++---------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/swing/src/net/sf/openrocket/gui/plot/SimulationPlotDialog.java b/swing/src/net/sf/openrocket/gui/plot/SimulationPlotDialog.java index ffcaec72f..d8a724ae5 100644 --- a/swing/src/net/sf/openrocket/gui/plot/SimulationPlotDialog.java +++ b/swing/src/net/sf/openrocket/gui/plot/SimulationPlotDialog.java @@ -83,6 +83,26 @@ public class SimulationPlotDialog extends JDialog { } }); panel.add(check, "split, left"); + + //// Add series selection box + ArrayList stages = new ArrayList(); + stages.add("All"); + stages.addAll(Util.generateSeriesLabels(simulation)); + + final JComboBox stageSelection = new JComboBox<>(stages.toArray(new String[0])); + stageSelection.addItemListener(new ItemListener() { + + @Override + public void itemStateChanged(ItemEvent e) { + int selectedStage = stageSelection.getSelectedIndex() - 1; + myPlot.setShowBranch(selectedStage); + } + + }); + if (stages.size() > 2) { + // Only show the combo box if there are at least 3 entries (ie, "All", "Main", and one other one) + panel.add(stageSelection, "gapleft rel"); + } //// Zoom in button JButton button = new SelectColorButton(Icons.ZOOM_IN); @@ -134,29 +154,6 @@ public class SimulationPlotDialog extends JDialog { }); panel.add(button, "gapleft rel"); - //// Add series selection box - ArrayList stages = new ArrayList(); - stages.add("All"); - stages.addAll(Util.generateSeriesLabels(simulation)); - - final JComboBox stageSelection = new JComboBox(stages.toArray(new String[0])); - stageSelection.addItemListener(new ItemListener() { - - @Override - public void itemStateChanged(ItemEvent e) { - int selectedStage = stageSelection.getSelectedIndex() - 1; - myPlot.setShowBranch(selectedStage); - } - - }); - if (stages.size() > 2) { - // Only show the combo box if there are at least 3 entries (ie, "All", "Main", and one other one - panel.add(stageSelection, "gapleft rel"); - } - - //// Spacer for layout to push close button to the right. - panel.add(new JPanel(), "growx"); - //// Close button button = new SelectColorButton(trans.get("dlg.but.close")); button.addActionListener(new ActionListener() { @@ -165,7 +162,7 @@ public class SimulationPlotDialog extends JDialog { SimulationPlotDialog.this.dispose(); } }); - panel.add(button, "right"); + panel.add(button, "gapbefore push, right"); this.setLocationByPlatform(true); this.pack();