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 的形式返回接收者的子節點。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM