void (JTree tree, TreePath path) { tree.expandPath(path); final TreeNode node = ((TreeNode)path.getLastPathComponent()); final Enumeration children = node.children(); while (children.hasMoreElements()) { TreeNode child = (TreeNode)children.nextElement(); expandPath(tree, path.pathByAddingChild(child)); } }