public class TreeNode<S> extends DefaultMutableTreeNode
DefaultMutableTreeNode.
© Copyright 2007 Sans Pareil Technologies, Inc.
DefaultMutableTreeNode.BreadthFirstEnumeration, DefaultMutableTreeNode.PathBetweenNodesEnumeration, DefaultMutableTreeNode.PostorderEnumeration, DefaultMutableTreeNode.PreorderEnumeration| Modifier and Type | Field and Description |
|---|---|
protected boolean |
initialised
A flag used to indicate that this node is uninitialised.
|
actionCommand, allowsChildren, children, EMPTY_ENUMERATION, parent, userObject| Constructor and Description |
|---|
TreeNode()
Creates a tree node that has no parent and no children, but which allows
children.
|
TreeNode(S userObject)
Creates a tree node with no parent, no children, but which allows children,
and initialises it with the specified user object.
|
TreeNode(S userObject,
boolean allowsChildren)
Creates a tree node with no parent, no children, initialised with the
specified user object, and that allows children only if specified.
|
| Modifier and Type | Method and Description |
|---|---|
S |
getUserObject()
Returns the underlying data object represented by this node.
|
void |
setUserObject(Object userObject)
Sets the underlying data object represented by this node.
|
add, breadthFirstEnumeration, children, depthFirstEnumeration, getActionCommand, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setActionCommand, setAllowsChildren, setParent, toStringprotected boolean initialised
DefaultMutableTreeNode.getChildCount() and
set accordingly.public TreeNode()
public TreeNode(S userObject)
userObject - The underlying object represented by this node.public TreeNode(S userObject, boolean allowsChildren)
userObject - The underlying object represented by this node.allowsChildren - Indicates whether this node allows children or not.public S getUserObject()
getUserObject in class DefaultMutableTreeNodepublic void setUserObject(Object userObject) throws IllegalArgumentException
setUserObject in interface MutableTreeNodesetUserObject in class DefaultMutableTreeNodeuserObject - The data object to represent.IllegalArgumentException - If the specified userObject does not
match the type for this node.