- Enclosing class:
public static class JTree.DynamicUtilTreeNode extends DefaultMutableTreeNode
DynamicUtilTreeNodecan wrap vectors/hashtables/arrays/strings and create the appropriate children tree nodes as necessary. It is dynamic in that it will only create the children as necessary.
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing. As of 1.4, support for long term storage
of all JavaBeans™
has been added to the
Fields Modifier and Type Field Description
childValueValue to create children with.
hasChildrenDoes the this
loadedChildrenHave the children been loaded yet?
Modifier and Type Method Description
children()Subclassed to load the children, if necessary.
createChildren(DefaultMutableTreeNode parent, Object children)Adds to parent all the children in
getChildAt(int index)Subclassed to load the children, if necessary.
getChildCount()Returns the number of child nodes.
isLeaf()Returns true if this node allows children.
loadChildren()Loads the children based on
Methods declared in class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildBefore, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject, toString
Creates a node with the specified object as its value and with the specified children. For the node to allow children, the children-object must be an array of objects, a
Vector, or a
Hashtable-- even if empty. Otherwise, the node is not allowed to have children.
Objectthat is the value for the new node
children- an array of
Vector, or a
Hashtableused to create the child nodes; if any other object is specified, or if the value is
null, then the node is not allowed to have children
Adds to parent all the children in
childrenis an array or vector all of its elements are added is children, otherwise if
childrenis a hashtable all the key/value pairs are added in the order
parent- the parent node
children- the children
public boolean isLeaf()Returns true if this node allows children. Whether the node allows children depends on how it was created.
public int getChildCount()Returns the number of child nodes.
protected void loadChildren()Loads the children based on
Vectoror array each element is added as a child, if
Hashtableeach key/value pair is added in the order that
Enumerationreturns the keys.
public TreeNode getChildAt(int index)Subclassed to load the children, if necessary.
Subclassed to load the children, if necessary.