| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a30d168 commit 67c3fb9
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,6 +23,7 @@ | |||
| 23 | 23 | package processing.app.ui; | |
| 24 | 24 | ||
| 25 | 25 | import java.awt.Component; | |
| 26 | + import java.awt.EventQueue; | ||
| 26 | 27 | ||
| 27 | 28 | import javax.swing.JTree; | |
| 28 | 29 | import javax.swing.tree.DefaultTreeCellRenderer; | |
@@ -50,12 +51,16 @@ public Component getTreeCellRendererComponent(JTree tree, Object value, | |||
| 50 | 51 | int high = getPreferredSize().height; | |
| 51 | 52 | if (high != 0) { | |
| 52 | 53 | // 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 | ||
| 57 | 58 | // 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 | + }); | ||
| 59 | 64 | } | |
| 60 | 65 | } | |
| 61 | 66 | return super.getTreeCellRendererComponent(tree, value, selected, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments