Java JTree saveExpansionState(JTree tree)

Here you can find the source of saveExpansionState(JTree tree)

Description

Save the expansion state of a tree.

License

Apache License

Parameter

Parameter Description
tree a parameter

Return

expanded tree path as Enumeration

Declaration

public static Enumeration<TreePath> saveExpansionState(JTree tree) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Enumeration;

import javax.swing.JTree;

import javax.swing.tree.TreePath;

public class Main {
    /**/*from   ww  w  .j  a  v  a  2s  .  co m*/
     * Save the expansion state of a tree.
     *
     * @param tree
     * @return expanded tree path as Enumeration
     */
    public static Enumeration<TreePath> saveExpansionState(JTree tree) {
        return tree.getExpandedDescendants(new TreePath(tree.getModel().getRoot()));
    }
}

Related

  1. printComponentTree(final JComponent fc)
  2. RemoveAll(JTree tree)
  3. repaintSelection(JTree tree)
  4. restoreExpanstionState(JTree tree, int row, String expansionState)
  5. revalidateTree(java.awt.Component c)
  6. saveExpansionStateStrings(JTree tree)
  7. saveTreeSelection(JTree tree)
  8. scrollToSelection(JTree tree)
  9. scrollTreeToSelectedRow(final JTree tree)