Skip to content

Commit

Permalink
Fix transitivity
Browse files Browse the repository at this point in the history
Read comments in commit, Swing has issues with toolbars and their focus
traversal policy when the look and feel does not decorate the window.
  • Loading branch information
RobertBColton committed Nov 4, 2014
1 parent e86d680 commit befdc03
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 11 additions & 4 deletions org/lateralgm/main/LGM.java
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2025,7 +2025,7 @@ public Icon getOpenIcon()
return null; return null;
} }
} }
public static void applyPreferences() { public static void applyPreferences() {


if (Prefs.direct3DAcceleration.equals("off")) { //$NON-NLS-1$ if (Prefs.direct3DAcceleration.equals("off")) { //$NON-NLS-1$
Expand Down Expand Up @@ -2060,9 +2060,9 @@ public static void applyPreferences() {
} }
} }


JFrame.setDefaultLookAndFeelDecorated(Prefs.decorateWindowBorders);
} }

public static void main(final String[] args) throws InvocationTargetException, InterruptedException public static void main(final String[] args) throws InvocationTargetException, InterruptedException
{ {
// Set the default uncaught exception handler. // Set the default uncaught exception handler.
Expand All @@ -2086,7 +2086,9 @@ public static void main(final String[] args) throws InvocationTargetException, I
iconspack = Prefs.iconPack; iconspack = Prefs.iconPack;
setLookAndFeel(Prefs.swingTheme); setLookAndFeel(Prefs.swingTheme);
themechanged = false; themechanged = false;

// must be called after setting the look and feel
JFrame.setDefaultLookAndFeelDecorated(Prefs.decorateWindowBorders);

//TODO: Break down this code and refactor it properly and make sure we don't put anymore Swing code in the EDT //TODO: Break down this code and refactor it properly and make sure we don't put anymore Swing code in the EDT
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {


Expand Down Expand Up @@ -2495,6 +2497,11 @@ public void actionPerformed(ActionEvent evt) {
filterPanel.setLayout(filterLayout); filterPanel.setLayout(filterLayout);
filterPanel.setFloatable(true); filterPanel.setFloatable(true);
filterPanel.setVisible(Prefs.showTreeFilter); filterPanel.setVisible(Prefs.showTreeFilter);
// This fixes an issue with Swing traversal comparator. Basically, Swing likes to throw false positives
// about transitivity when window decorations are disabled.
// The exception occurs on Windows 8 at startup from the Event Dispatch Thread with the Swing Look and Feel when
// window decorations are disabled.
filterPanel.setFocusTraversalPolicyProvider(true);


JScrollPane scroll = new JScrollPane(tree); JScrollPane scroll = new JScrollPane(tree);
scroll.setPreferredSize(new Dimension(250,100)); scroll.setPreferredSize(new Dimension(250,100));
Expand Down
2 changes: 1 addition & 1 deletion org/lateralgm/messages/messages.properties
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ QuickFind.HIGHLIGHT = Highlight All


AboutBox.TITLE=About LateralGM AboutBox.TITLE=About LateralGM
AboutBox.ABOUT=<h1 style="white-space: nowrap">Copyright &copy; 2006-2014</h1>\ AboutBox.ABOUT=<h1 style="white-space: nowrap">Copyright &copy; 2006-2014</h1>\
<p style="white-space: nowrap">Version: 1.8.6.758<br><br>\ <p style="white-space: nowrap">Version: 1.8.6.759<br><br>\
IsmAvatar \ IsmAvatar \
&lt;<a href="mailto:IsmAvatar@gmail.com">IsmAvatar@gmail.com</a>&gt;<br>\ &lt;<a href="mailto:IsmAvatar@gmail.com">IsmAvatar@gmail.com</a>&gt;<br>\
Clam \ Clam \
Expand Down

0 comments on commit befdc03

Please sign in to comment.