| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
TreePath path = …;
TreeNode node = (TreeNode)path.getLastPathComponent();
Based on 14 examples
public interface TreeNode
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 {@link 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.
Method Summary | |
---|---|
Enumeration |
children() Returns the children of the receiver as an Enumeration .
|
boolean |
Returns true if the receiver allows children. |
TreeNode |
getChildAt(int childIndex) Returns the child TreeNode at index
childIndex .
|
int |
Returns the number of children TreeNode s the receiver
contains.
|
int |
Returns the index of node in the receivers children.
|
TreeNode |
Returns the parent TreeNode of the receiver.
|
boolean |
isLeaf() Returns true if the receiver is a leaf. |
Method Detail |
---|
public Enumeration children()
Enumeration
.
public boolean getAllowsChildren()
public TreeNode getChildAt(int childIndex)
TreeNode
at index
childIndex
.
childIndex
public int getChildCount()
TreeNode
s the receiver
contains.
public int getIndex(TreeNode node)
node
in the receivers children.
If the receiver does not contain node
, -1 will be
returned.
node
public TreeNode getParent()
TreeNode
of the receiver.
public boolean isLeaf()
| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |