モジュール java.desktop
パッケージ javax.swing.tree

インタフェースTreeNode

既知のすべてのサブインタフェース:
MutableTreeNode
既知のすべての実装クラス:
AbstractDocument.AbstractElement, AbstractDocument.BranchElement, AbstractDocument.LeafElement, DefaultMutableTreeNode, DefaultStyledDocument.SectionElement, HTMLDocument.BlockElement, HTMLDocument.RunElement, JTree.DynamicUtilTreeNode

public interface TreeNode
JTree内のツリー・ノードとして使用できるオブジェクトに関する要求を定義します。

equalsをオーバーライドするTreeNodeの実装であり、通常、hashCodeもオーバーライドする必要があります。 詳細は、TreeModelを参照してください。 ツリー・ノードの詳細および使用例は、「The Java Tutorial」の「How to Use Tree Nodes」を参照してください。

  • メソッドのサマリー

    修飾子と型
    メソッド
    説明
    レシーバの子をEnumerationとして返します。
    boolean
    レシーバが子を許可する場合はtrueを返します。
    getChildAt(int childIndex)
    インデックスchildIndexにある子TreeNodeを返します。
    int
    TreeNodeのレシーバが格納する子の数を返します。
    int
    レシーバの子の中でnodeのインデックスを返します。
    レシーバの親TreeNodeを返します。
    boolean
    レシーバが葉である場合はtrueを返します。
  • メソッドの詳細

    • getChildAt

      TreeNode getChildAt(int childIndex)
      インデックスchildIndexにある子TreeNodeを返します。
      パラメータ:
      childIndex - 子のインデックス
      戻り値:
      指定されたインデックスの子ノード
    • getChildCount

      int getChildCount()
      TreeNodeのレシーバが格納する子の数を返します。
      戻り値:
      レシーバが含む子の数
    • getParent

      TreeNode getParent()
      レシーバの親TreeNodeを返します。
      戻り値:
      レシーバの親
    • getIndex

      int getIndex(TreeNode node)
      レシーバの子の中でnodeのインデックスを返します。 レシーバがnodeを格納しない場合は、-1が返されます。
      パラメータ:
      node - ルークするノード
      戻り値:
      指定されたノードのインデックス
    • getAllowsChildren

      boolean getAllowsChildren()
      レシーバが子を許可する場合はtrueを返します。
      戻り値:
      レシーバが子を許可するかどうか
    • isLeaf

      boolean isLeaf()
      レシーバが葉である場合はtrueを返します。
      戻り値:
      レシーバがリーフかどうか
    • children

      Enumeration<? extends TreeNode> children()
      レシーバの子をEnumerationとして返します。
      戻り値:
      レシーバの子(Enumeration)