javax.swing.tree

Interface TreeNode

public interface TreeNode

A tree node.
Method Summary
Enumerationchildren()
Returns an enumeration of the children of this node, or an empty enumeration if this node has no children.
booleangetAllowsChildren()
Returns true if this node allows children, and false otherwise.
TreeNodegetChildAt(int index)
Returns the child node at the given index.
intgetChildCount()
Returns the number of children for this node.
intgetIndex(TreeNode node)
Returns the index of the specified child node, or -1 if the node is not in fact a child of this node.
TreeNodegetParent()
Returns the parent node for this tree node, or null if this node has no parent.
booleanisLeaf()
Returns true if this node is a leaf node, and false otherwise.

Method Detail

children

public 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.

getAllowsChildren

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

Returns: A boolean.

getChildAt

public 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

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

Returns: The number of children for this node.

getIndex

public 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.

getParent

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

Returns: The parent node (possibly null).

isLeaf

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

Returns: A boolean.