Here you can find the source of loadExpansionState(JTree tree, Enumeration
Parameter | Description |
---|---|
tree | a parameter |
expansionState | an Enumeration of expansion state. You can get it using #saveExpansionState(javax.swing.JTree) . |
public static void loadExpansionState(JTree tree, Enumeration<TreePath> expansionState)
//package com.java2s; //License from project: Apache License import java.util.Enumeration; import javax.swing.JTree; import javax.swing.tree.TreePath; public class Main { /**// w w w .j a va 2 s . c o m * Restore the expansion state of a JTree. * Note: this will NOT work for most use-cases in IPSmallJava as data-model of tree is reset after most tasks. * * @param tree * @param expansionState an Enumeration of expansion state. You can get it using {@link #saveExpansionState(javax.swing.JTree)}. */ public static void loadExpansionState(JTree tree, Enumeration<TreePath> expansionState) { if (expansionState != null) { while (expansionState.hasMoreElements()) { TreePath treePath = (TreePath) expansionState.nextElement(); tree.expandPath(treePath); } } } }