forked from XWxiaowei/JavaCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTreeNode.java
More file actions
87 lines (77 loc) · 1.75 KB
/
TreeNode.java
File metadata and controls
87 lines (77 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
* 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.
* <p>
* Implementations of <code>TreeNode</code> that override <code>equals</code>
* will typically need to override <code>hashCode</code> as well. Refer
* to {@link javax.swing.tree.TreeModel} for more information.
*
* For further information and examples of using tree nodes,
* see <a
href="https://docs.oracle.com/javase/tutorial/uiswing/components/tree.html">How to Use Tree Nodes</a>
* in <em>The Java Tutorial.</em>
*
* @author Rob Davis
* @author Scott Violet
*/
public interface TreeNode
{
/**
* Returns the child <code>TreeNode</code> at index
* <code>childIndex</code>.
*/
TreeNode getChildAt(int childIndex);
/**
* Returns the number of children <code>TreeNode</code>s the receiver
* contains.
*/
int getChildCount();
/**
* Returns the parent <code>TreeNode</code> of the receiver.
*/
TreeNode getParent();
/**
* Returns the index of <code>node</code> in the receivers children.
* If the receiver does not contain <code>node</code>, -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 <code>Enumeration</code>.
*/
Enumeration children();
}