- 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.
Warning: 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
java.beanspackage. Please see
- See Also:
- Serialized Form
Fields Modifier and Type Field Description
childValueValue to create children with.
hasChildrenDoes the this
loadedChildrenHave the children been loaded yet?
All Methods Static Methods Instance Methods Concrete Methods 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 inherited from 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
protected boolean hasChildrenDoes the this
JTreehave children? This property is currently not implemented.
protected Object childValueValue to create children with.
protected 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
public static void createChildren(DefaultMutableTreeNode parent, Object 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.