FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

attempt to fix examples window spinning in Windows (#5246) · unexCoder/processing@67c3fb9 · GitHub

Repository navigation

Commit 67c3fb9

Browse files
committed
attempt to fix examples window spinning in Windows (processing#5246)
1 parent a30d168 commit 67c3fb9

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

‎app/src/processing/app/ui/ZoomTreeCellRenderer.java‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
package processing.app.ui;
2424

2525
import java.awt.Component;
26+
import java.awt.EventQueue;
2627

2728
import javax.swing.JTree;
2829
import javax.swing.tree.DefaultTreeCellRenderer;
@@ -50,12 +51,16 @@ public Component getTreeCellRendererComponent(JTree tree, Object value,
5051
int high = getPreferredSize().height;
5152
if (high != 0) {
5253
// Source Sans leading too short, so also add 15% for nicer spacing
53-
high = (int) (high * 1.15f);
54-
int current = getSize().height;
55-
if (current != high) {
56-
// This seems to be causing an infinite loop on Windows
54+
final int targetHeight = (int) (high * 1.15f);
55+
int currentHeight = getSize().height;
56+
if (currentHeight != targetHeight) {
57+
// Using invokeLater() to avoid infinite loop on Windows
5758
// https://github.com/processing/processing/issues/5246
58-
tree.setRowHeight(high);
59+
EventQueue.invokeLater(new Runnable() {
60+
public void run() {
61+
tree.setRowHeight(targetHeight);
62+
}
63+
});
5964
}
6065
}
6166
return super.getTreeCellRendererComponent(tree, value, selected,

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL