Here you can find the source of expandAllNodes(JTree tree, TreeNode node)
tree
that descend from node
Parameter | Description |
---|---|
tree | a parameter |
node | a parameter |
private static void expandAllNodes(JTree tree, TreeNode node)
//package com.java2s; //it under the terms of the GNU Affero General Public License as published by import javax.swing.*; import javax.swing.tree.*; public class Main { /**/*from www.j a v a2s. c o m*/ * expands all nodes in the <code>tree</code> * @param tree * @precondition tree != null */ public static void expandAllNodes(JTree tree) { expandAllNodes(tree, (TreeNode) tree.getModel().getRoot()); } /** * expands all nodes in the <code>tree</code> that descend from <code>node</code> * @param tree * @param node */ private static void expandAllNodes(JTree tree, TreeNode node) { final TreePath treepath = new TreePath(((DefaultMutableTreeNode) node).getPath()); tree.expandPath(treepath); for (int i = 0; i < node.getChildCount(); i++) { expandAllNodes(tree, node.getChildAt(i)); } } }