/* * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package javax.swing.tree; import java.util.Enumeration; /** * Defines the requirements for an object that can be used as a * tree node in a JTree. *

* Implementations of TreeNode that override equals * will typically need to override hashCode as well. Refer * to {@link javax.swing.tree.TreeModel} for more information. * * For further information and examples of using tree nodes, * see How to Use Tree Nodes * in The Java Tutorial. * * @author Rob Davis * @author Scott Violet */ public interface TreeNode { /** * Returns the child TreeNode at index * childIndex. */ TreeNode getChildAt(int childIndex); /** * Returns the number of children TreeNodes the receiver * contains. */ int getChildCount(); /** * Returns the parent TreeNode of the receiver. */ TreeNode getParent(); /** * Returns the index of node in the receivers children. * If the receiver does not contain node, -1 will be * returned. */ int getIndex(TreeNode node); /** * Returns true if the receiver allows children. */ boolean getAllowsChildren(); /** * Returns true if the receiver is a leaf. */ boolean isLeaf(); /** * Returns the children of the receiver as an Enumeration. */ Enumeration children(); }