Author: tchemit Date: 2009-10-03 10:45:25 +0200 (Sat, 03 Oct 2009) New Revision: 1546 Modified: trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingUtil.java Log: add expandTree method to expand all nodes of a tree Modified: trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingUtil.java =================================================================== --- trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingUtil.java 2009-10-02 09:28:22 UTC (rev 1545) +++ trunk/jaxx-runtime-swing/src/main/java/jaxx/runtime/SwingUtil.java 2009-10-03 08:45:25 UTC (rev 1546) @@ -46,6 +46,7 @@ import javax.swing.JList; import javax.swing.JRootPane; import javax.swing.JTabbedPane; +import javax.swing.JTree; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.event.HyperlinkEvent; @@ -736,4 +737,22 @@ } } } + + /** + * Expand all childs of a tree. + * + * @param tree the tree to expand + */ + public static void expandTree(final JTree tree) { + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + int i = 0; + while (i < tree.getRowCount()) { + tree.expandRow(i++); + } + } + }); + } }
participants (1)
-
tchemit@users.nuiton.org