diff --git a/OpticalSignalingCommsToolbox/src/main/java/edu/nps/moves/qrtda/swing/QRTdaGuiPanel.form b/OpticalSignalingCommsToolbox/src/main/java/edu/nps/moves/qrtda/swing/QRTdaGuiPanel.form index ee72833110d4df483bbb42b4d9861494c625866b..d70b80beb0795d298452a2f623964efb7d747bcc 100644 --- a/OpticalSignalingCommsToolbox/src/main/java/edu/nps/moves/qrtda/swing/QRTdaGuiPanel.form +++ b/OpticalSignalingCommsToolbox/src/main/java/edu/nps/moves/qrtda/swing/QRTdaGuiPanel.form @@ -217,7 +217,7 @@ </Container> <Container class="javax.swing.JSplitPane" name="sourceContentSplit"> <Properties> - <Property name="dividerLocation" type="int" value="100"/> + <Property name="dividerLocation" type="int" value="500"/> <Property name="orientation" type="int" value="0"/> </Properties> <Constraints> diff --git a/OpticalSignalingCommsToolbox/src/main/java/edu/nps/moves/qrtda/swing/QRTdaGuiPanel.java b/OpticalSignalingCommsToolbox/src/main/java/edu/nps/moves/qrtda/swing/QRTdaGuiPanel.java index 2d152305698be3c66a72a80db24f293db90270cd..1cfccfd34c9850d125d19d724c25bbd8c493d33d 100644 --- a/OpticalSignalingCommsToolbox/src/main/java/edu/nps/moves/qrtda/swing/QRTdaGuiPanel.java +++ b/OpticalSignalingCommsToolbox/src/main/java/edu/nps/moves/qrtda/swing/QRTdaGuiPanel.java @@ -82,9 +82,9 @@ public class QRTdaGuiPanel extends JPanel implements ReadyListener private void setupSplitListeners() { - ElementListSplit.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, splitListener); TBSplit.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, splitListener); LRSplit.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, splitListener); + ElementListSplit.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, splitListener); sourceContentSplit.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, splitListener); } @@ -157,28 +157,25 @@ public class QRTdaGuiPanel extends JPanel implements ReadyListener LRDIVIDERLOCATION_PREF = _LRDIVIDERLOCATION_PREF + stream; ELEMENTDIVIDERLOCATION_PREF = _ELEMENTDIVIDERLOCATION_PREF + stream; SRCCONTENTDIVIDERLOCATION_PREF = _SRCCONTENTDIVIDERLOCATION_PREF + stream; + + /* + This screwy invocation is required to make the splitpane settings work on Windows. Apparently + the gui event thread runs differently than on Mac, and setting one divider without finishing out the + last is a problem. + */ new Thread(new Runnable() { @Override public void run() { - try{Thread.sleep(1000l);}catch(InterruptedException ex){} - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() - { - ElementListSplit.setDividerLocation(Integer.parseInt(QRPreferences.getInstance().get(ELEMENTDIVIDERLOCATION_PREF, "-1"))); - sourceContentSplit.setDividerLocation(Integer.parseInt(QRPreferences.getInstance().get(SRCCONTENTDIVIDERLOCATION_PREF, "-1"))); - TBSplit.setDividerLocation(Integer.parseInt(QRPreferences.getInstance().get(TBDIVIDERLOCATION_PREF, "-1"))); - LRSplit.setDividerLocation(Integer.parseInt(QRPreferences.getInstance().get(LRDIVIDERLOCATION_PREF, "-1"))); - } - }); - try{Thread.sleep(1000l);}catch(InterruptedException ex){} - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() - { - setupSplitListeners(); - } - }); + try { + SwingUtilities.invokeAndWait(()->TBSplit.setDividerLocation(Integer.parseInt(QRPreferences.getInstance().get(TBDIVIDERLOCATION_PREF, "-1")))); + SwingUtilities.invokeAndWait(()->LRSplit.setDividerLocation(Integer.parseInt(QRPreferences.getInstance().get(LRDIVIDERLOCATION_PREF, "-1")))); + SwingUtilities.invokeAndWait(()->ElementListSplit.setDividerLocation(Integer.parseInt(QRPreferences.getInstance().get(ELEMENTDIVIDERLOCATION_PREF, "-1")))); + SwingUtilities.invokeAndWait(()->sourceContentSplit.setDividerLocation(Integer.parseInt(QRPreferences.getInstance().get(SRCCONTENTDIVIDERLOCATION_PREF, "-1")))); + } + catch(InterruptedException | InvocationTargetException ex) { + System.out.println("Error setting splitter dividers"); + } + SwingUtilities.invokeLater(()->setupSplitListeners()); } }).start(); } @@ -481,7 +478,7 @@ public class QRTdaGuiPanel extends JPanel implements ReadyListener LRSplit.setLeftComponent(leftPanel); - sourceContentSplit.setDividerLocation(100); + sourceContentSplit.setDividerLocation(500); sourceContentSplit.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT); SourceTextPan.setLayout(new java.awt.GridBagLayout());