TreeSelectionEvent (Java SE 15 & JDK 15) (original) (raw)

All Implemented Interfaces:

[Serializable](../../../../java.base/java/io/Serializable.html "interface in java.io")


public class TreeSelectionEvent extends EventObject

An event that characterizes a change in the current selection. The change is based on any number of paths. TreeSelectionListeners will generally query the source of the event for the new selected status of each potentially changed row.

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.

See Also:

TreeSelectionListener, TreeSelectionModel

Fields

Modifier and Type Field 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.

Constructors

Constructor Description
TreeSelectionEvent​(Object source,TreePath[] paths, boolean[] areNew,TreePath oldLeadSelectionPath,TreePath newLeadSelectionPath) Represents a change in the selection of a TreeSelectionModel.
TreeSelectionEvent​(Object source,TreePath path, boolean isNew,TreePath oldLeadSelectionPath,TreePath newLeadSelectionPath) Represents a change in the selection of a TreeSelectionModel.
Modifier and Type Method Description
Object cloneWithSource​(Object newSource) 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 path) Returns whether the specified path was added to the selection.