|
Java Platform 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.swing.tree.TreePath
Represents a path to a node. TreePath is Serializable, but if any components of the path are not serializable, it will not be written out.
Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.
Constructor Summary | |
protected |
TreePath()
Primarily provided for subclasses that don't wish to use the path ivar. |
|
TreePath(Object singlePath)
Constructs a TreePath when there is only item in the path. |
|
TreePath(Object[] path)
Constructs a path from an array of Objects, uniquely identifying the path from the root of the tree to a specific node, as returned by the tree's data model. |
protected |
TreePath(Object[] path,
int length)
|
protected |
TreePath(TreePath parent,
Object lastElement)
Constructs a TreePath this is the combination of all the path elements in parent with a last path component of
lastElement . |
Method Summary | |
boolean |
equals(Object o)
Tests two TreePaths for equality by checking each element of the paths for equality. |
Object |
getLastPathComponent()
Returns the last component of this path. |
TreePath |
getParentPath()
Returns a path containing all the elements of the receiver, accept the last path component. |
Object[] |
getPath()
Returns an array of Objects containing the components of this TreePath. |
Object |
getPathComponent(int element)
Returns the path component at the specified index. |
int |
getPathCount()
Returns the number of elements in the path. |
int |
hashCode()
Returns the hashCode for the object. |
boolean |
isDescendant(TreePath aTreePath)
Returns true if the specified node is a descendant of this TreePath. |
TreePath |
pathByAddingChild(Object child)
Returns a new path containing all the elements of this receiver plus child . |
String |
toString()
Returns a string that displays and identifies this object's properties. |
Methods inherited from class java.lang.Object |
clone,
finalize,
getClass,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public TreePath(Object[] path)
The model is free to return an array of any Objects it needs to represent the path. The DefaultTreeModel returns an array of TreeNode objects. The first TreeNode in the path is the root of the tree, the last TreeNode is the node identified by the path.
path
- an array of Objects representing the path to a nodepublic TreePath(Object singlePath)
singlePath
- an Object representing the path to a nodeTreePath(Object[])
protected TreePath(TreePath parent, Object lastElement)
parent
with a last path component of
lastElement
.protected TreePath(Object[] path, int length)
protected TreePath()
Method Detail |
public Object[] getPath()
TreePath(Object[])
public Object getLastPathComponent()
TreePath(Object[])
public int getPathCount()
public Object getPathComponent(int element)
element
- an int specifying an element in the path, where
0 is the first element in the pathTreePath(Object[])
public boolean equals(Object o)
o
- the Object to comparepublic int hashCode()
public boolean isDescendant(TreePath aTreePath)
public TreePath pathByAddingChild(Object child)
child
. This will throw a NullPointerException
if child is null.public TreePath getParentPath()
public String toString()
|
Java Platform 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |