Java JTree Expand fullExpand(JTree tree, TreePath parentPath, int nExpansions)

Here you can find the source of fullExpand(JTree tree, TreePath parentPath, int nExpansions)

Description

full Expand

License

Open Source License

Declaration

private static int fullExpand(JTree tree, TreePath parentPath, int nExpansions) 

Method Source Code

//package com.java2s;

import javax.swing.JTree;

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

public class Main {
    private static int fullExpand(JTree tree, TreePath parentPath, int nExpansions) {
        TreeNode parent = (TreeNode) parentPath.getLastPathComponent();
        int count = parent.getChildCount();
        for (int i = 0; i < count && nExpansions > 0; ++i) {
            TreeNode child = parent.getChildAt(i);
            TreePath childPath = parentPath.pathByAddingChild(child);
            //ESCA-JAVA0119
            nExpansions = fullExpand(tree, childPath, nExpansions);
        }//  w  ww.j a  v a 2s.co m
        tree.expandPath(parentPath);
        return --nExpansions;
    }
}

Related

  1. expandPaths(JTree tree, Collection paths)
  2. expandTree(JTree tree, boolean expand)
  3. expandTree(JTree tree, TreeNode start, int level)
  4. expandTreeLevels(JTree tree, TreePath parent, boolean expand, int desiredLevel)
  5. expandTreePaths(JTree tree, Enumeration expandPaths)
  6. getExpandedPaths(JTree tree)
  7. getExpandedPaths(JTree tree)
  8. getLastExpandedNodes(final JTree tree)
  9. getPaths(JTree tree, boolean expanded)