javax.swing.tree
Class TreePath
- Serializable
A
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
Object
.
TreePath() - Default constructor.
|
TreePath(Object element) - Creates a new path from a single element.
|
TreePath(Object[] path) - Creates a path from the list of objects representing tree elements.
|
TreePath(Object[] path, int length) - Creates a new tree path using the first
length elements
from the given array.
|
TreePath(TreePath path, Object element) - Creates a new tree path by adding the specified
element to
the path .
|
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
TreePath
protected TreePath()
Default constructor.
TreePath
public TreePath(Object element)
Creates a new path from a single element.
element
- the element (null
not permitted).
TreePath
public TreePath(Object[] path)
Creates a path from the list of objects representing tree elements. The
incoming array is copied so that subsequent changes do not affect this
tree path.
path
- the elements in the path (null
not permitted).
TreePath
protected TreePath(Object[] path,
int length)
Creates a new tree path using the first length
elements
from the given array.
path
- the path elements.length
- the path length.
TreePath
protected TreePath(TreePath path,
Object element)
Creates a new tree path by adding the specified element
to
the path
.
path
- a tree path.element
- a path element.
equals
public boolean equals(Object object)
Tests this path for equality with an arbitrary object. An object is
considered equal to this path if and only if:
- the object is not
null
; - the object is an instanceof
TreePath
; - the object contains the same elements in the same order as this
TreePath
;
- equals in interface Object
object
- the object (null
permitted).
true
if obj
is equal to this tree path,
and false
otherwise.
getParentPath
public TreePath getParentPath()
Returns the parent path, which is a path containing all the same elements
as this path, except for the last one. If this path contains only one
element, the method returns null
.
- The parent path, or
null
if this path has only one
element.
getPath
public Object[] getPath()
Returns an array containing the path elements.
- An array containing the path elements.
getPathComponent
public Object getPathComponent(int position)
Returns the element at the specified position in the path.
position
- the element position (0 < N - 1
, where
N
is the number of elements in the path).
- The element at the specified position.
getPathCount
public int getPathCount()
Returns the number of elements in the path.
- The number of elements in the path.
isDescendant
public boolean isDescendant(TreePath path)
Returns true
if path
is a descendant of this
path, and false
otherwise. If path
is
null
, this method returns false
.
path
- the path to check (null
permitted).
true
if path
is a descendant of this
path, and false
otherwise
toString
public String toString()
Returns a string representation of this path.
- toString in interface Object
- A string representation of this path.
TreePath.java --
Copyright (C) 2002, 2005, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.