public class TreeSelectionEvent extends EventObject
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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.
TreeSelectionListener,
TreeSelectionModel
| Modifier and Type | Field and Description |
|---|---|
protected boolean[] |
areNew
For each path identifies if that path is in fact new.
|
protected TreePath |
newLeadSelectionPath
leadSelectionPath after the paths changed, may be null.
|
protected TreePath |
oldLeadSelectionPath
leadSelectionPath before the paths changed, may be null.
|
protected TreePath |
paths
Paths this event represents.
|
source| Constructor and Description |
|---|
TreeSelectionEvent(Object
Represents a change in the selection of a TreeSelectionModel.
|
TreeSelectionEvent(Object
Represents a change in the selection of a TreeSelectionModel.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
cloneWithSource(Object
Returns a copy of the receiver, but with the source being newSource.
|
TreePath |
getNewLeadSelectionPath()
Returns the current lead path.
|
TreePath |
getOldLeadSelectionPath()
Returns the path that was previously the lead path.
|
TreePath |
getPath()
Returns the first path element.
|
TreePath |
getPaths()
Returns the paths that have been added or removed from the selection.
|
boolean |
isAddedPath()
Returns whether the path identified by
getPath was added to the selection.
|
boolean |
isAddedPath(int index)
Returns whether the path at
getPaths()[index] was added to the selection.
|
boolean |
isAddedPath(TreePath
Returns whether the specified path was added to the selection.
|
getSource, toStringprotected TreePath[] paths
protected boolean[] areNew
protected TreePatholdLeadSelectionPath
protected TreePathnewLeadSelectionPath
public TreeSelectionEvent(Objectsource, TreePath [] paths, boolean[] areNew, TreePath oldLeadSelectionPath, TreePath newLeadSelectionPath)
source - source of event
paths - the paths that have changed in the selection
public TreeSelectionEvent(Objectsource, TreePath path, boolean isNew, TreePath oldLeadSelectionPath, TreePath newLeadSelectionPath)
source - source of event
path - the path that has changed in the selection
isNew - whether or not the path is new to the selection, false means path was removed from the selection.
public TreePath[] getPaths()
public TreePathgetPath()
public boolean isAddedPath()
getPath was added to the selection. A return value of
true indicates the path identified by
getPath was added to the selection. A return value of
false indicates
getPath was selected, but is no longer selected.
true if
getPath was added to the selection,
false otherwise
public boolean isAddedPath(TreePathpath)
true indicates the path identified by
path was added to the selection. A return value of
false indicates
path is no longer selected. This method is only valid for the paths returned from
getPaths(); invoking with a path not included in
getPaths() throws an
IllegalArgumentException.
path - the path to test
true if
path was added to the selection,
false otherwise
IllegalArgumentException - if
path is not contained in
getPaths
getPaths()
public boolean isAddedPath(int index)
getPaths()[index] was added to the selection. A return value of
true indicates the path was added to the selection. A return value of
false indicates the path is no longer selected.
index - the index of the path to test
true if the path was added to the selection,
false otherwise
IllegalArgumentException - if index is outside the range of
getPaths
getPaths()
public TreePathgetOldLeadSelectionPath()
public TreePathgetNewLeadSelectionPath()