JavaTM 2 Platform
Standard Ed. 6

javax.swing.tree
接口 TreeNode

所有已知子接口:
MutableTreeNode
所有已知实现类:
AbstractDocument.AbstractElement, AbstractDocument.BranchElement, AbstractDocument.LeafElement, DefaultMutableTreeNode, DefaultStyledDocument.SectionElement, HTMLDocument.BlockElement, HTMLDocument.RunElement, JTree.DynamicUtilTreeNode

public interface TreeNode

定义可以用作 JTree 中树节点的对象所需的要求。

重写 equalsTreeNode 的实现通常也需要重写 hashCode。有关更多信息,请参阅 TreeModel。 有关使用树节点的更多信息和示例,请参阅 The Java Tutorial 中的 How to Use Tree Nodes


方法摘要
 Enumeration children()
          以 Enumeration 的形式返回接收者的子节点。
 boolean getAllowsChildren()
          如果接收者允许有子节点,则返回 true。
 TreeNode getChildAt(int childIndex)
          返回索引 childIndex 位置的子 TreeNode
 int getChildCount()
          返回接收者包含的子 TreeNode 数。
 int getIndex(TreeNode node)
          返回接收者子节点中的 node 的索引。
 TreeNode getParent()
          返回接收者的父 TreeNode
 boolean isLeaf()
          如果接收者是一个叶节点,则返回 true。
 

方法详细信息

getChildAt

TreeNode getChildAt(int childIndex)
返回索引 childIndex 位置的子 TreeNode


getChildCount

int getChildCount()
返回接收者包含的子 TreeNode 数。


getParent

TreeNode getParent()
返回接收者的父 TreeNode


getIndex

int getIndex(TreeNode node)
返回接收者子节点中的 node 的索引。如果接收者不包含 node,则返回 -1。


getAllowsChildren

boolean getAllowsChildren()
如果接收者允许有子节点,则返回 true。


isLeaf

boolean isLeaf()
如果接收者是一个叶节点,则返回 true。


children

Enumeration children()
Enumeration 的形式返回接收者的子节点。


JavaTM 2 Platform
Standard Ed. 6

提交错误或意见

版权所有 2008 Sun Microsystems, Inc. 保留所有权利。请遵守GNU General Public License, version 2 only