java TreeNode接口

今天写安卓程序见到一个方法getChildAt();不懂其用边去百度搜索了一下,看到了它的api,细致看看原来是在接口里面如今我把这个api贴给大家共享假设是操作xml我认为用这个非常方便

javax.swing.tree 
接口 TreeNode

全部已知子接口:
MutableTreeNode
全部已知实现类:
AbstractDocument.AbstractElementAbstractDocument.BranchElementAbstractDocument.LeafElementDefaultMutableTreeNodeDefaultStyledDocument.SectionElement,HTMLDocument.BlockElementHTMLDocument.RunElementJTree.DynamicUtilTreeNode

public interface TreeNode

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

重写 equals 的 TreeNode 的实现通常也须要重写 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 的形式返回接收者的子节点。

原文地址:https://www.cnblogs.com/lxjshuju/p/7395157.html