DefaultMutableTreeNode (Java Platform SE 8 ) (original) (raw)
Modifier and Type
Method
Description
void
[add](../../../javax/swing/tree/DefaultMutableTreeNode.html#add-javax.swing.tree.MutableTreeNode-)([MutableTreeNode](../../../javax/swing/tree/MutableTreeNode.html "interface in javax.swing.tree") newChild)
Removes newChild
from its parent and makes it a child of this node by adding it to the end of this node's child array.
[Enumeration](../../../java/util/Enumeration.html "interface in java.util")
[breadthFirstEnumeration](../../../javax/swing/tree/DefaultMutableTreeNode.html#breadthFirstEnumeration--)()
Creates and returns an enumeration that traverses the subtree rooted at this node in breadth-first order.
[Enumeration](../../../java/util/Enumeration.html "interface in java.util")
[children](../../../javax/swing/tree/DefaultMutableTreeNode.html#children--)()
Creates and returns a forward-order enumeration of this node's children.
[Object](../../../java/lang/Object.html "class in java.lang")
[clone](../../../javax/swing/tree/DefaultMutableTreeNode.html#clone--)()
Overridden to make clone public.
[Enumeration](../../../java/util/Enumeration.html "interface in java.util")
[depthFirstEnumeration](../../../javax/swing/tree/DefaultMutableTreeNode.html#depthFirstEnumeration--)()
Creates and returns an enumeration that traverses the subtree rooted at this node in depth-first order.
boolean
[getAllowsChildren](../../../javax/swing/tree/DefaultMutableTreeNode.html#getAllowsChildren--)()
Returns true if this node is allowed to have children.
[TreeNode](../../../javax/swing/tree/TreeNode.html "interface in javax.swing.tree")
[getChildAfter](../../../javax/swing/tree/DefaultMutableTreeNode.html#getChildAfter-javax.swing.tree.TreeNode-)([TreeNode](../../../javax/swing/tree/TreeNode.html "interface in javax.swing.tree") aChild)
Returns the child in this node's child array that immediately follows aChild
, which must be a child of this node.
[TreeNode](../../../javax/swing/tree/TreeNode.html "interface in javax.swing.tree")
[getChildAt](../../../javax/swing/tree/DefaultMutableTreeNode.html#getChildAt-int-)(int index)
Returns the child at the specified index in this node's child array.
[TreeNode](../../../javax/swing/tree/TreeNode.html "interface in javax.swing.tree")
[getChildBefore](../../../javax/swing/tree/DefaultMutableTreeNode.html#getChildBefore-javax.swing.tree.TreeNode-)([TreeNode](../../../javax/swing/tree/TreeNode.html "interface in javax.swing.tree") aChild)
Returns the child in this node's child array that immediately precedes aChild
, which must be a child of this node.
int
[getChildCount](../../../javax/swing/tree/DefaultMutableTreeNode.html#getChildCount--)()
Returns the number of children of this node.
int
[getDepth](../../../javax/swing/tree/DefaultMutableTreeNode.html#getDepth--)()
Returns the depth of the tree rooted at this node -- the longest distance from this node to a leaf.
[TreeNode](../../../javax/swing/tree/TreeNode.html "interface in javax.swing.tree")
[getFirstChild](../../../javax/swing/tree/DefaultMutableTreeNode.html#getFirstChild--)()
Returns this node's first child.
[DefaultMutableTreeNode](../../../javax/swing/tree/DefaultMutableTreeNode.html "class in javax.swing.tree")
[getFirstLeaf](../../../javax/swing/tree/DefaultMutableTreeNode.html#getFirstLeaf--)()
Finds and returns the first leaf that is a descendant of this node -- either this node or its first child's first leaf.
int
[getIndex](../../../javax/swing/tree/DefaultMutableTreeNode.html#getIndex-javax.swing.tree.TreeNode-)([TreeNode](../../../javax/swing/tree/TreeNode.html "interface in javax.swing.tree") aChild)
Returns the index of the specified child in this node's child array.
[TreeNode](../../../javax/swing/tree/TreeNode.html "interface in javax.swing.tree")
[getLastChild](../../../javax/swing/tree/DefaultMutableTreeNode.html#getLastChild--)()
Returns this node's last child.
[DefaultMutableTreeNode](../../../javax/swing/tree/DefaultMutableTreeNode.html "class in javax.swing.tree")
[getLastLeaf](../../../javax/swing/tree/DefaultMutableTreeNode.html#getLastLeaf--)()
Finds and returns the last leaf that is a descendant of this node -- either this node or its last child's last leaf.
int
[getLeafCount](../../../javax/swing/tree/DefaultMutableTreeNode.html#getLeafCount--)()
Returns the total number of leaves that are descendants of this node.
int
[getLevel](../../../javax/swing/tree/DefaultMutableTreeNode.html#getLevel--)()
Returns the number of levels above this node -- the distance from the root to this node.
[DefaultMutableTreeNode](../../../javax/swing/tree/DefaultMutableTreeNode.html "class in javax.swing.tree")
[getNextLeaf](../../../javax/swing/tree/DefaultMutableTreeNode.html#getNextLeaf--)()
Returns the leaf after this node or null if this node is the last leaf in the tree.
[DefaultMutableTreeNode](../../../javax/swing/tree/DefaultMutableTreeNode.html "class in javax.swing.tree")
[getNextNode](../../../javax/swing/tree/DefaultMutableTreeNode.html#getNextNode--)()
Returns the node that follows this node in a preorder traversal of this node's tree.
[DefaultMutableTreeNode](../../../javax/swing/tree/DefaultMutableTreeNode.html "class in javax.swing.tree")
[getNextSibling](../../../javax/swing/tree/DefaultMutableTreeNode.html#getNextSibling--)()
Returns the next sibling of this node in the parent's children array.
[TreeNode](../../../javax/swing/tree/TreeNode.html "interface in javax.swing.tree")
[getParent](../../../javax/swing/tree/DefaultMutableTreeNode.html#getParent--)()
Returns this node's parent or null if this node has no parent.
[TreeNode](../../../javax/swing/tree/TreeNode.html "interface in javax.swing.tree")[]
[getPath](../../../javax/swing/tree/DefaultMutableTreeNode.html#getPath--)()
Returns the path from the root, to get to this node.
protected [TreeNode](../../../javax/swing/tree/TreeNode.html "interface in javax.swing.tree")[]
[getPathToRoot](../../../javax/swing/tree/DefaultMutableTreeNode.html#getPathToRoot-javax.swing.tree.TreeNode-int-)([TreeNode](../../../javax/swing/tree/TreeNode.html "interface in javax.swing.tree") aNode, int depth)
Builds the parents of node up to and including the root node, where the original node is the last element in the returned array.
[DefaultMutableTreeNode](../../../javax/swing/tree/DefaultMutableTreeNode.html "class in javax.swing.tree")
[getPreviousLeaf](../../../javax/swing/tree/DefaultMutableTreeNode.html#getPreviousLeaf--)()
Returns the leaf before this node or null if this node is the first leaf in the tree.
[DefaultMutableTreeNode](../../../javax/swing/tree/DefaultMutableTreeNode.html "class in javax.swing.tree")
[getPreviousNode](../../../javax/swing/tree/DefaultMutableTreeNode.html#getPreviousNode--)()
Returns the node that precedes this node in a preorder traversal of this node's tree.
[DefaultMutableTreeNode](../../../javax/swing/tree/DefaultMutableTreeNode.html "class in javax.swing.tree")
[getPreviousSibling](../../../javax/swing/tree/DefaultMutableTreeNode.html#getPreviousSibling--)()
Returns the previous sibling of this node in the parent's children array.
[TreeNode](../../../javax/swing/tree/TreeNode.html "interface in javax.swing.tree")
[getRoot](../../../javax/swing/tree/DefaultMutableTreeNode.html#getRoot--)()
Returns the root of the tree that contains this node.
[TreeNode](../../../javax/swing/tree/TreeNode.html "interface in javax.swing.tree")
[getSharedAncestor](../../../javax/swing/tree/DefaultMutableTreeNode.html#getSharedAncestor-javax.swing.tree.DefaultMutableTreeNode-)([DefaultMutableTreeNode](../../../javax/swing/tree/DefaultMutableTreeNode.html "class in javax.swing.tree") aNode)
Returns the nearest common ancestor to this node and aNode
.
int
[getSiblingCount](../../../javax/swing/tree/DefaultMutableTreeNode.html#getSiblingCount--)()
Returns the number of siblings of this node.
[Object](../../../java/lang/Object.html "class in java.lang")
[getUserObject](../../../javax/swing/tree/DefaultMutableTreeNode.html#getUserObject--)()
Returns this node's user object.
[Object](../../../java/lang/Object.html "class in java.lang")[]
[getUserObjectPath](../../../javax/swing/tree/DefaultMutableTreeNode.html#getUserObjectPath--)()
Returns the user object path, from the root, to get to this node.
void
[insert](../../../javax/swing/tree/DefaultMutableTreeNode.html#insert-javax.swing.tree.MutableTreeNode-int-)([MutableTreeNode](../../../javax/swing/tree/MutableTreeNode.html "interface in javax.swing.tree") newChild, int childIndex)
Removes newChild
from its present parent (if it has a parent), sets the child's parent to this node, and then adds the child to this node's child array at index childIndex
.
boolean
[isLeaf](../../../javax/swing/tree/DefaultMutableTreeNode.html#isLeaf--)()
Returns true if this node has no children.
boolean
[isNodeAncestor](../../../javax/swing/tree/DefaultMutableTreeNode.html#isNodeAncestor-javax.swing.tree.TreeNode-)([TreeNode](../../../javax/swing/tree/TreeNode.html "interface in javax.swing.tree") anotherNode)
Returns true if anotherNode
is an ancestor of this node -- if it is this node, this node's parent, or an ancestor of this node's parent.
boolean
[isNodeChild](../../../javax/swing/tree/DefaultMutableTreeNode.html#isNodeChild-javax.swing.tree.TreeNode-)([TreeNode](../../../javax/swing/tree/TreeNode.html "interface in javax.swing.tree") aNode)
Returns true if aNode
is a child of this node.
boolean
[isNodeDescendant](../../../javax/swing/tree/DefaultMutableTreeNode.html#isNodeDescendant-javax.swing.tree.DefaultMutableTreeNode-)([DefaultMutableTreeNode](../../../javax/swing/tree/DefaultMutableTreeNode.html "class in javax.swing.tree") anotherNode)
Returns true if anotherNode
is a descendant of this node -- if it is this node, one of this node's children, or a descendant of one of this node's children.
boolean
[isNodeRelated](../../../javax/swing/tree/DefaultMutableTreeNode.html#isNodeRelated-javax.swing.tree.DefaultMutableTreeNode-)([DefaultMutableTreeNode](../../../javax/swing/tree/DefaultMutableTreeNode.html "class in javax.swing.tree") aNode)
Returns true if and only if aNode
is in the same tree as this node.
boolean
[isNodeSibling](../../../javax/swing/tree/DefaultMutableTreeNode.html#isNodeSibling-javax.swing.tree.TreeNode-)([TreeNode](../../../javax/swing/tree/TreeNode.html "interface in javax.swing.tree") anotherNode)
Returns true if anotherNode
is a sibling of (has the same parent as) this node.
boolean
[isRoot](../../../javax/swing/tree/DefaultMutableTreeNode.html#isRoot--)()
Returns true if this node is the root of the tree.
[Enumeration](../../../java/util/Enumeration.html "interface in java.util")
[pathFromAncestorEnumeration](../../../javax/swing/tree/DefaultMutableTreeNode.html#pathFromAncestorEnumeration-javax.swing.tree.TreeNode-)([TreeNode](../../../javax/swing/tree/TreeNode.html "interface in javax.swing.tree") ancestor)
Creates and returns an enumeration that follows the path fromancestor
to this node.
[Enumeration](../../../java/util/Enumeration.html "interface in java.util")
[postorderEnumeration](../../../javax/swing/tree/DefaultMutableTreeNode.html#postorderEnumeration--)()
Creates and returns an enumeration that traverses the subtree rooted at this node in postorder.
[Enumeration](../../../java/util/Enumeration.html "interface in java.util")
[preorderEnumeration](../../../javax/swing/tree/DefaultMutableTreeNode.html#preorderEnumeration--)()
Creates and returns an enumeration that traverses the subtree rooted at this node in preorder.
void
[remove](../../../javax/swing/tree/DefaultMutableTreeNode.html#remove-int-)(int childIndex)
Removes the child at the specified index from this node's children and sets that node's parent to null.
void
[remove](../../../javax/swing/tree/DefaultMutableTreeNode.html#remove-javax.swing.tree.MutableTreeNode-)([MutableTreeNode](../../../javax/swing/tree/MutableTreeNode.html "interface in javax.swing.tree") aChild)
Removes aChild
from this node's child array, giving it a null parent.
void
[removeAllChildren](../../../javax/swing/tree/DefaultMutableTreeNode.html#removeAllChildren--)()
Removes all of this node's children, setting their parents to null.
void
[removeFromParent](../../../javax/swing/tree/DefaultMutableTreeNode.html#removeFromParent--)()
Removes the subtree rooted at this node from the tree, giving this node a null parent.
void
[setAllowsChildren](../../../javax/swing/tree/DefaultMutableTreeNode.html#setAllowsChildren-boolean-)(boolean allows)
Determines whether or not this node is allowed to have children.
void
[setParent](../../../javax/swing/tree/DefaultMutableTreeNode.html#setParent-javax.swing.tree.MutableTreeNode-)([MutableTreeNode](../../../javax/swing/tree/MutableTreeNode.html "interface in javax.swing.tree") newParent)
Sets this node's parent to newParent
but does not change the parent's child array.
void
[setUserObject](../../../javax/swing/tree/DefaultMutableTreeNode.html#setUserObject-java.lang.Object-)([Object](../../../java/lang/Object.html "class in java.lang") userObject)
Sets the user object for this node to userObject
.
[String](../../../java/lang/String.html "class in java.lang")
[toString](../../../javax/swing/tree/DefaultMutableTreeNode.html#toString--)()
Returns the result of sending toString()
to this node's user object, or the empty string if the node has no user object.