- 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
protected ObjectValue to create children with.
protected booleanDoes the this
protected booleanHave the children been loaded yet?
Modifier and Type Method Description
()Subclassed to load the children, if necessary.
DefaultMutableTreeNode parent, Object children)(Adds to parent all the children in
(int index)Subclassed to load the children, if necessary.
()Returns the number of child nodes.
()Returns true if this node allows children.
()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
hasChildrenprotected boolean hasChildrenDoes the this
JTreehave children? This property is currently not implemented.
childValueprotected Object childValueValue to create children with.
loadedChildrenprotected boolean loadedChildrenHave the children been loaded yet?
DynamicUtilTreeNodeCreates 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
createChildrenAdds 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
isLeafpublic boolean isLeaf()Returns true if this node allows children. Whether the node allows children depends on how it was created.
getChildCountpublic int getChildCount()Returns the number of child nodes.
loadChildrenprotected 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.
getChildAtpublic TreeNode getChildAt(int index)Subclassed to load the children, if necessary.
childrenSubclassed to load the children, if necessary.