javax.swing.tree
public class TreePath extends Object implements Serializable
TreePath
represents a sequence of tree elements that form
a path starting from the root of a tree. A tree element can be represented
by any {@link Object}.
Constructor Summary | |
---|---|
TreePath(Object[] path)
Creates a path from the list of objects representing tree elements. | |
TreePath(Object element)
Creates a new path from a single element.
| |
protected | TreePath(TreePath path, Object element)
Creates a new tree path by adding the specified element to
the path .
|
protected | TreePath(Object[] path, int length)
Creates a new tree path using the first length elements
from the given array.
|
protected | TreePath()
Default constructor. |
Method Summary | |
---|---|
boolean | equals(Object object)
Tests this path for equality with an arbitrary object. |
Object | getLastPathComponent()
Returns the last object in the path.
|
TreePath | getParentPath()
Returns the parent path, which is a path containing all the same elements
as this path, except for the last one. |
Object[] | getPath()
Returns an array containing the path elements.
|
Object | getPathComponent(int position)
Returns the element at the specified position in the path.
|
int | getPathCount()
Returns the number of elements in the path.
|
int | hashCode()
Returns a hashcode for the path.
|
boolean | isDescendant(TreePath path)
Returns true if path is a descendant of this
path, and false otherwise. |
TreePath | pathByAddingChild(Object element)
Creates a new path that is equivalent to this path plus the specified
element.
|
String | toString()
Returns a string representation of this path.
|
Parameters: path the elements in the path (null
not permitted).
Throws: IllegalArgumentException if path
is null
.
Parameters: element the element (null
not permitted).
Throws: IllegalArgumentException if element
is
null
.
element
to
the path
.
Parameters: path a tree path. element a path element.
length
elements
from the given array.
Parameters: path the path elements. length the path length.
null
;Parameters: object the object (null
permitted).
Returns: true
if obj
is equal to this tree path,
and false
otherwise.
Returns: The last object in the path.
null
.
Returns: The parent path, or null
if this path has only one
element.
Returns: An array containing the path elements.
Parameters: position the element position (0 < N - 1
, where
N
is the number of elements in the path).
Returns: The element at the specified position.
Throws: IllegalArgumentException if position
is outside the
valid range.
Returns: The number of elements in the path.
Returns: A hashcode.
true
if path
is a descendant of this
path, and false
otherwise. If path
is
null
, this method returns false
.
Parameters: path the path to check (null
permitted).
Returns: true
if path
is a descendant of this
path, and false
otherwise
Parameters: element the element.
Returns: A tree path.
Returns: A string representation of this path.