Skip to content
Snippets Groups Projects
Commit 4a7bf334 authored by J. M. Bailey's avatar J. M. Bailey
Browse files

Fix splitpanes on Windows

parent 9fa5acb2
No related branches found
No related tags found
No related merge requests found
...@@ -217,7 +217,7 @@ ...@@ -217,7 +217,7 @@
</Container> </Container>
<Container class="javax.swing.JSplitPane" name="sourceContentSplit"> <Container class="javax.swing.JSplitPane" name="sourceContentSplit">
<Properties> <Properties>
<Property name="dividerLocation" type="int" value="100"/> <Property name="dividerLocation" type="int" value="500"/>
<Property name="orientation" type="int" value="0"/> <Property name="orientation" type="int" value="0"/>
</Properties> </Properties>
<Constraints> <Constraints>
......
...@@ -82,9 +82,9 @@ public class QRTdaGuiPanel extends JPanel implements ReadyListener ...@@ -82,9 +82,9 @@ public class QRTdaGuiPanel extends JPanel implements ReadyListener
private void setupSplitListeners() private void setupSplitListeners()
{ {
ElementListSplit.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, splitListener);
TBSplit.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, splitListener); TBSplit.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, splitListener);
LRSplit.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); sourceContentSplit.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, splitListener);
} }
...@@ -157,28 +157,25 @@ public class QRTdaGuiPanel extends JPanel implements ReadyListener ...@@ -157,28 +157,25 @@ public class QRTdaGuiPanel extends JPanel implements ReadyListener
LRDIVIDERLOCATION_PREF = _LRDIVIDERLOCATION_PREF + stream; LRDIVIDERLOCATION_PREF = _LRDIVIDERLOCATION_PREF + stream;
ELEMENTDIVIDERLOCATION_PREF = _ELEMENTDIVIDERLOCATION_PREF + stream; ELEMENTDIVIDERLOCATION_PREF = _ELEMENTDIVIDERLOCATION_PREF + stream;
SRCCONTENTDIVIDERLOCATION_PREF = _SRCCONTENTDIVIDERLOCATION_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() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
try{Thread.sleep(1000l);}catch(InterruptedException ex){} try {
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeAndWait(()->TBSplit.setDividerLocation(Integer.parseInt(QRPreferences.getInstance().get(TBDIVIDERLOCATION_PREF, "-1"))));
@Override SwingUtilities.invokeAndWait(()->LRSplit.setDividerLocation(Integer.parseInt(QRPreferences.getInstance().get(LRDIVIDERLOCATION_PREF, "-1"))));
public void run() SwingUtilities.invokeAndWait(()->ElementListSplit.setDividerLocation(Integer.parseInt(QRPreferences.getInstance().get(ELEMENTDIVIDERLOCATION_PREF, "-1"))));
{ SwingUtilities.invokeAndWait(()->sourceContentSplit.setDividerLocation(Integer.parseInt(QRPreferences.getInstance().get(SRCCONTENTDIVIDERLOCATION_PREF, "-1"))));
ElementListSplit.setDividerLocation(Integer.parseInt(QRPreferences.getInstance().get(ELEMENTDIVIDERLOCATION_PREF, "-1"))); }
sourceContentSplit.setDividerLocation(Integer.parseInt(QRPreferences.getInstance().get(SRCCONTENTDIVIDERLOCATION_PREF, "-1"))); catch(InterruptedException | InvocationTargetException ex) {
TBSplit.setDividerLocation(Integer.parseInt(QRPreferences.getInstance().get(TBDIVIDERLOCATION_PREF, "-1"))); System.out.println("Error setting splitter dividers");
LRSplit.setDividerLocation(Integer.parseInt(QRPreferences.getInstance().get(LRDIVIDERLOCATION_PREF, "-1"))); }
} SwingUtilities.invokeLater(()->setupSplitListeners());
});
try{Thread.sleep(1000l);}catch(InterruptedException ex){}
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run()
{
setupSplitListeners();
}
});
} }
}).start(); }).start();
} }
...@@ -481,7 +478,7 @@ public class QRTdaGuiPanel extends JPanel implements ReadyListener ...@@ -481,7 +478,7 @@ public class QRTdaGuiPanel extends JPanel implements ReadyListener
LRSplit.setLeftComponent(leftPanel); LRSplit.setLeftComponent(leftPanel);
sourceContentSplit.setDividerLocation(100); sourceContentSplit.setDividerLocation(500);
sourceContentSplit.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT); sourceContentSplit.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
SourceTextPan.setLayout(new java.awt.GridBagLayout()); SourceTextPan.setLayout(new java.awt.GridBagLayout());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment