Java JTree Expand expandAllNode(JTree tree, TreePath parent)

Here you can find the source of expandAllNode(JTree tree, TreePath parent)

Description

expand All Node

License

Open Source License

Declaration

private static void expandAllNode(JTree tree, TreePath parent) 

Method Source Code


//package com.java2s;

import java.util.Enumeration;

import javax.swing.JTree;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;

public class Main {
    private static void expandAllNode(JTree tree, TreePath parent) {
        TreeNode node = (TreeNode) parent.getLastPathComponent();
        if (node.getChildCount() >= 0) {
            for (Enumeration<?> e = node.children(); e.hasMoreElements();) {
                TreeNode n = (TreeNode) e.nextElement();
                TreePath path = parent.pathByAddingChild(n);
                expandAllNode(tree, path);
            }//from  w  w  w .  j  a  v  a  2  s . c  o  m
        } // end of if
        tree.expandPath(parent);
    }
}

Related

  1. expandAll(JTree tree)
  2. expandAll(JTree tree)
  3. expandAll(JTree tree)
  4. expandAll(JTree tree, boolean expand)
  5. expandAll(JTree tree, boolean expand)
  6. expandAllNodes(final JTree tree)
  7. expandAllNodes(JTree tree)
  8. expandAllNodes(JTree tree)
  9. expandAllNodes(JTree tree, int startingIndex, int rowCount)