From 4ea5a6ade500e992370df115f46841e7b2a8a8d4 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Sat, 30 Jul 2022 21:49:42 +0200 Subject: [PATCH] Fix stage highlight not working --- .../sf/openrocket/gui/main/BasicFrame.java | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/swing/src/net/sf/openrocket/gui/main/BasicFrame.java b/swing/src/net/sf/openrocket/gui/main/BasicFrame.java index e67146cad..e982d3563 100644 --- a/swing/src/net/sf/openrocket/gui/main/BasicFrame.java +++ b/swing/src/net/sf/openrocket/gui/main/BasicFrame.java @@ -160,17 +160,9 @@ public class BasicFrame extends JFrame { componentSelectionModel = new DefaultTreeSelectionModel(); componentSelectionModel.setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); - // Create the component tree - tree = new ComponentTree(document); - tree.setSelectionModel(componentSelectionModel); - // ----- Create the different BasicFrame panels ----- log.debug("Constructing the BasicFrame UI"); - //// Bottom segment, rocket figure - rocketpanel = new RocketPanel(document, this); - rocketpanel.setSelectionModel(tree.getSelectionModel()); - //// Top segment, tabbed pane simulationPanel = new SimulationPanel(document); { @@ -185,6 +177,12 @@ public class BasicFrame extends JFrame { // Create RocketActions actions = new RocketActions(document, selectionModel, this, simulationPanel); } + { + // Create the component tree + tree = new ComponentTree(document); + tree.setSelectionModel(componentSelectionModel); + } + designPanel = new DesignPanel(this, document, tree); flightConfigurationPanel = new FlightConfigurationPanel(this, document); tabbedPane = new JTabbedPane(); @@ -192,6 +190,14 @@ public class BasicFrame extends JFrame { tabbedPane.addTab(trans.get("BasicFrame.tab.Flightconfig"), null, flightConfigurationPanel); tabbedPane.addTab(trans.get("BasicFrame.tab.Flightsim"), null, simulationPanel); + // Add change listener to catch when the tabs are changed. This is to run simulations + // automatically when the simulation tab is selected. + tabbedPane.addChangeListener(new BasicFrame_changeAdapter(this)); + + //// Bottom segment, rocket figure + rocketpanel = new RocketPanel(document, this); + rocketpanel.setSelectionModel(tree.getSelectionModel()); + //// The main vertical split pane JSplitPane vertical = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true); vertical.setResizeWeight(0.5); @@ -212,10 +218,6 @@ public class BasicFrame extends JFrame { popupMenu.add(actions.getScaleAction()); } - // Add change listener to catch when the tabs are changed. This is to run simulations - // automatically when the simulation tab is selected. - tabbedPane.addChangeListener(new BasicFrame_changeAdapter(this)); - createMenu();