KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > swing > tree > TreeNode


1 /*
2  * @(#)TreeNode.java 1.23 04/07/13
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.swing.tree;
9
10 import java.util.Enumeration JavaDoc;
11
12 /**
13  * Defines the requirements for an object that can be used as a
14  * tree node in a JTree.
15  *
16  * <p>
17  *
18  * For further information and examples of using tree nodes,
19  * see <a
20  href="http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html">How to Use Tree Nodes</a>
21  * in <em>The Java Tutorial.</em>
22  *
23  * @version 1.23 07/13/04
24  * @author Rob Davis
25  * @author Scott Violet
26  */

27
28 public interface TreeNode
29 {
30     /**
31      * Returns the child <code>TreeNode</code> at index
32      * <code>childIndex</code>.
33      */

34     TreeNode JavaDoc getChildAt(int childIndex);
35
36     /**
37      * Returns the number of children <code>TreeNode</code>s the receiver
38      * contains.
39      */

40     int getChildCount();
41
42     /**
43      * Returns the parent <code>TreeNode</code> of the receiver.
44      */

45     TreeNode JavaDoc getParent();
46
47     /**
48      * Returns the index of <code>node</code> in the receivers children.
49      * If the receiver does not contain <code>node</code>, -1 will be
50      * returned.
51      */

52     int getIndex(TreeNode JavaDoc node);
53
54     /**
55      * Returns true if the receiver allows children.
56      */

57     boolean getAllowsChildren();
58
59     /**
60      * Returns true if the receiver is a leaf.
61      */

62     boolean isLeaf();
63
64     /**
65      * Returns the children of the receiver as an <code>Enumeration</code>.
66      */

67     Enumeration JavaDoc children();
68 }
69
Popular Tags