JavaTM 2 Platform
Standard Ed. 6

介面 javax.swing.tree.MutableTreeNode
的使用

使用 MutableTreeNode 的軟體套件
javax.swing 提供一組“輕量級”(全部是 Java 語言)元件,盡量讓這些元件在所有平臺上的工作方式都相同。 
javax.swing.tree 提供處理 javax.swing.JTree 的類別和介面。 
 

javax.swing 中 MutableTreeNode 的使用
 

實作 MutableTreeNode 的 javax.swing 中的類別
static class JTree.DynamicUtilTreeNode
          DynamicUtilTreeNode 可以包裹 vectors/hashtables/arrays/strings 並根據需要創建適當的子階層樹節點。
 

javax.swing.tree 中 MutableTreeNode 的使用
 

實作 MutableTreeNode 的 javax.swing.tree 中的類別
 class DefaultMutableTreeNode
          DefaultMutableTreeNode 是階層樹資料結構中的通用節點。
 

宣告為 MutableTreeNode 的 javax.swing.tree 中的欄位
protected  MutableTreeNode DefaultMutableTreeNode.parent
          此節點的父節點,如果此節點沒有父節點,則為 null
 

參數型別為 MutableTreeNode 的 javax.swing.tree 中的方法
 void DefaultMutableTreeNode.add(MutableTreeNode newChild)
          從其父節點移除 newChild,並通過將其添加到此節點的子陣列的結尾,使其成為此節點的子節點。
 void DefaultMutableTreeNode.insert(MutableTreeNode newChild, int childIndex)
          從其現有父節點移除 newChild(如果它有父節點),將子節點的父節點設置為此節點,然後,將該子節點添加到此節點位於索引 childIndex 處的子節點陣列。
 void MutableTreeNode.insert(MutableTreeNode child, int index)
          將 child 添加到 index 位置的接收者。
 void DefaultTreeModel.insertNodeInto(MutableTreeNode newChild, MutableTreeNode parent, int index)
          對它進行調用,以便在父節點的子節點中的 index 位置插入 newChild。
 void DefaultMutableTreeNode.remove(MutableTreeNode aChild)
          通過向其提供一個 null 父節點,從此節點的子節點陣列移除 aChild。
 void MutableTreeNode.remove(MutableTreeNode node)
          從接收者移除 node。
 void DefaultTreeModel.removeNodeFromParent(MutableTreeNode node)
          通知它從其父節點中移除節點。
 void DefaultMutableTreeNode.setParent(MutableTreeNode newParent)
          將此節點的父節點設置為 newParent,但不更改父節點的子節點陣列。
 void MutableTreeNode.setParent(MutableTreeNode newParent)
          將接收者的父物件設置為 newParent。
 


JavaTM 2 Platform
Standard Ed. 6

提交錯誤或意見

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