javax.swing.tree
Interface TreeNode

All Known Subinterfaces:
MutableTreeNode
All Known Implementing Classes:
AbstractDocument.AbstractElement, AbstractDocument.BranchElement, AbstractDocument.LeafElement, DefaultMutableTreeNode, DefaultStyledDocument.SectionElement, HTMLDocument.BlockElement, HTMLDocument.RunElement, JTree.DynamicUtilTreeNode

public interface TreeNode

A tree node.


Method Summary
 Enumeration children()
          Returns an enumeration of the children of this node, or an empty enumeration if this node has no children.
 boolean getAllowsChildren()
          Returns true if this node allows children, and false otherwise.
 TreeNode getChildAt(int index)
          Returns the child node at the given index.
 int getChildCount()
          Returns the number of children for this node.
 int getIndex(TreeNode node)
          Returns the index of the specified child node, or -1 if the node is not in fact a child of this node.
 TreeNode getParent()
          Returns the parent node for this tree node, or null if this node has no parent.
 boolean isLeaf()
          Returns true if this node is a leaf node, and false otherwise.
 

Method Detail

getParent

TreeNode getParent()
Returns the parent node for this tree node, or null if this node has no parent.

Returns:
The parent node (possibly null).

getIndex

int getIndex(TreeNode node)
Returns the index of the specified child node, or -1 if the node is not in fact a child of this node.

Parameters:
node - the node (null not permitted).
Returns:
The index of the specified child node, or -1.
Throws:
IllegalArgumentException - if node is null.

getChildAt

TreeNode getChildAt(int index)
Returns the child node at the given index.

Parameters:
index - the index (in the range 0 to getChildCount() - 1).
Returns:
The child node at the given index.

getChildCount

int getChildCount()
Returns the number of children for this node.

Returns:
The number of children for this node.

getAllowsChildren

boolean getAllowsChildren()
Returns true if this node allows children, and false otherwise.

Returns:
A boolean.

isLeaf

boolean isLeaf()
Returns true if this node is a leaf node, and false otherwise.

Returns:
A boolean.

children

Enumeration children()
Returns an enumeration of the children of this node, or an empty enumeration if this node has no children.

Returns:
An enumeration of the children of this node.