APIdia Launch Partner
Top Description Methods
javax.swing.tree

public Interface TreeNode

Known Direct Subinterfaces
javax.swing.tree.MutableTreeNode
Known Direct Implementers
javax.swing.text.AbstractDocument.AbstractElement
Imports
java.util.Enumeration

Defines the requirements for an object that can be used as a tree node in a JTree.

Implementations of TreeNode that override equals will typically need to override hashCode as well. Refer to javax.swing.tree.TreeModel for more information. For further information and examples of using tree nodes, see How to Use Tree Nodes in The Java Tutorial.

Authors
Rob Davis, Scott Violet

Method Summary

Modifier and TypeMethod and Description
public Enumeration<? extends TreeNode>

Returns:

the children of the receiver as an Enumeration
children
()

Returns the children of the receiver as an Enumeration.

public boolean

Returns:

whether the receiver allows children
getAllowsChildren
()

Returns true if the receiver allows children.

public TreeNode

Returns:

the child node at given index
getChildAt
(int
index of child
childIndex
)

Returns the child TreeNode at index childIndex.

public int

Returns:

the number of children the receiver contains
getChildCount
()

Returns the number of children TreeNodes the receiver contains.

public int

Returns:

index of specified node
getIndex
(TreeNode
node to be looked for
node
)

Returns the index of node in the receivers children.

public TreeNode

Returns:

the parent of the receiver
getParent
()

Returns the parent TreeNode of the receiver.

public boolean

Returns:

whether the receiver is a leaf
isLeaf
()

Returns true if the receiver is a leaf.

Method Detail

childrenback to summary
public Enumeration<? extends TreeNode> children()

Returns the children of the receiver as an Enumeration.

Returns:Enumeration<? extends TreeNode>

the children of the receiver as an Enumeration

getAllowsChildrenback to summary
public boolean getAllowsChildren()

Returns true if the receiver allows children.

Returns:boolean

whether the receiver allows children

getChildAtback to summary
public TreeNode getChildAt(int childIndex)

Returns the child TreeNode at index childIndex.

Parameters
childIndex:int

index of child

Returns:TreeNode

the child node at given index

getChildCountback to summary
public int getChildCount()

Returns the number of children TreeNodes the receiver contains.

Returns:int

the number of children the receiver contains

getIndexback to summary
public int getIndex(TreeNode node)

Returns the index of node in the receivers children. If the receiver does not contain node, -1 will be returned.

Parameters
node:TreeNode

node to be looked for

Returns:int

index of specified node

getParentback to summary
public TreeNode getParent()

Returns the parent TreeNode of the receiver.

Returns:TreeNode

the parent of the receiver

isLeafback to summary
public boolean isLeaf()

Returns true if the receiver is a leaf.

Returns:boolean

whether the receiver is a leaf