javax.swing.event
Class TreeSelectionEvent

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.util.EventObject sample code for java.util.EventObject definition code for java.util.EventObject 
      extended by javax.swing.event.TreeSelectionEvent
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable

public class TreeSelectionEvent
extends EventObject sample code for java.util.EventObject definition code for java.util.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 JavaBeansTM has been added to the java.beans package. Please see XMLEncoder sample code for java.beans.XMLEncoder definition code for java.beans.XMLEncoder .

See Also:
TreeSelectionListener sample code for javax.swing.event.TreeSelectionListener definition code for javax.swing.event.TreeSelectionListener , TreeSelectionModel sample code for javax.swing.tree.TreeSelectionModel definition code for javax.swing.tree.TreeSelectionModel , Serialized Form

Field Summary
protected  boolean[] areNew sample code for javax.swing.event.TreeSelectionEvent.areNew definition code for javax.swing.event.TreeSelectionEvent.areNew
          For each path identifies if that is path is in fact new.
protected  TreePath sample code for javax.swing.tree.TreePath definition code for javax.swing.tree.TreePath newLeadSelectionPath sample code for javax.swing.event.TreeSelectionEvent.newLeadSelectionPath definition code for javax.swing.event.TreeSelectionEvent.newLeadSelectionPath
          leadSelectionPath after the paths changed, may be null.
protected  TreePath sample code for javax.swing.tree.TreePath definition code for javax.swing.tree.TreePath oldLeadSelectionPath sample code for javax.swing.event.TreeSelectionEvent.oldLeadSelectionPath definition code for javax.swing.event.TreeSelectionEvent.oldLeadSelectionPath
          leadSelectionPath before the paths changed, may be null.
protected  TreePath sample code for javax.swing.tree.TreePath definition code for javax.swing.tree.TreePath [] paths sample code for javax.swing.event.TreeSelectionEvent.paths definition code for javax.swing.event.TreeSelectionEvent.paths
          Paths this event represents.
 
Fields inherited from class java.util.EventObject sample code for java.util.EventObject definition code for java.util.EventObject
source sample code for java.util.EventObject.source definition code for java.util.EventObject.source
 
Constructor Summary
TreeSelectionEvent sample code for javax.swing.event.TreeSelectionEvent.TreeSelectionEvent(java.lang.Object, javax.swing.tree.TreePath[], boolean[], javax.swing.tree.TreePath, javax.swing.tree.TreePath) definition code for javax.swing.event.TreeSelectionEvent.TreeSelectionEvent(java.lang.Object, javax.swing.tree.TreePath[], boolean[], javax.swing.tree.TreePath, javax.swing.tree.TreePath) (Object sample code for java.lang.Object definition code for java.lang.Object  source, TreePath sample code for javax.swing.tree.TreePath definition code for javax.swing.tree.TreePath [] paths, boolean[] areNew, TreePath sample code for javax.swing.tree.TreePath definition code for javax.swing.tree.TreePath  oldLeadSelectionPath, TreePath sample code for javax.swing.tree.TreePath definition code for javax.swing.tree.TreePath  newLeadSelectionPath)
          Represents a change in the selection of a TreeSelectionModel.
TreeSelectionEvent sample code for javax.swing.event.TreeSelectionEvent.TreeSelectionEvent(java.lang.Object, javax.swing.tree.TreePath, boolean, javax.swing.tree.TreePath, javax.swing.tree.TreePath) definition code for javax.swing.event.TreeSelectionEvent.TreeSelectionEvent(java.lang.Object, javax.swing.tree.TreePath, boolean, javax.swing.tree.TreePath, javax.swing.tree.TreePath) (Object sample code for java.lang.Object definition code for java.lang.Object  source, TreePath sample code for javax.swing.tree.TreePath definition code for javax.swing.tree.TreePath  path, boolean isNew, TreePath sample code for javax.swing.tree.TreePath definition code for javax.swing.tree.TreePath  oldLeadSelectionPath, TreePath sample code for javax.swing.tree.TreePath definition code for javax.swing.tree.TreePath  newLeadSelectionPath)
          Represents a change in the selection of a TreeSelectionModel.
 
Method Summary
 Object sample code for java.lang.Object definition code for java.lang.Object cloneWithSource sample code for javax.swing.event.TreeSelectionEvent.cloneWithSource(java.lang.Object) definition code for javax.swing.event.TreeSelectionEvent.cloneWithSource(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  newSource)
          Returns a copy of the receiver, but with the source being newSource.
 TreePath sample code for javax.swing.tree.TreePath definition code for javax.swing.tree.TreePath getNewLeadSelectionPath sample code for javax.swing.event.TreeSelectionEvent.getNewLeadSelectionPath() definition code for javax.swing.event.TreeSelectionEvent.getNewLeadSelectionPath() ()
          Returns the current lead path.
 TreePath sample code for javax.swing.tree.TreePath definition code for javax.swing.tree.TreePath getOldLeadSelectionPath sample code for javax.swing.event.TreeSelectionEvent.getOldLeadSelectionPath() definition code for javax.swing.event.TreeSelectionEvent.getOldLeadSelectionPath() ()
          Returns the path that was previously the lead path.
 TreePath sample code for javax.swing.tree.TreePath definition code for javax.swing.tree.TreePath getPath sample code for javax.swing.event.TreeSelectionEvent.getPath() definition code for javax.swing.event.TreeSelectionEvent.getPath() ()
          Returns the first path element.
 TreePath sample code for javax.swing.tree.TreePath definition code for javax.swing.tree.TreePath [] getPaths sample code for javax.swing.event.TreeSelectionEvent.getPaths() definition code for javax.swing.event.TreeSelectionEvent.getPaths() ()
          Returns the paths that have been added or removed from the selection.
 boolean isAddedPath sample code for javax.swing.event.TreeSelectionEvent.isAddedPath() definition code for javax.swing.event.TreeSelectionEvent.isAddedPath() ()
          Returns true if the first path element has been added to the selection, a return value of false means the first path has been removed from the selection.
 boolean isAddedPath sample code for javax.swing.event.TreeSelectionEvent.isAddedPath(int) definition code for javax.swing.event.TreeSelectionEvent.isAddedPath(int) (int index)
          Returns true if the path identified by index was added to the selection.
 boolean isAddedPath sample code for javax.swing.event.TreeSelectionEvent.isAddedPath(javax.swing.tree.TreePath) definition code for javax.swing.event.TreeSelectionEvent.isAddedPath(javax.swing.tree.TreePath) (TreePath sample code for javax.swing.tree.TreePath definition code for javax.swing.tree.TreePath  path)
          Returns true if the path identified by path was added to the selection.
 
Methods inherited from class java.util.EventObject sample code for java.util.EventObject definition code for java.util.EventObject
getSource sample code for java.util.EventObject.getSource() definition code for java.util.EventObject.getSource() , toString sample code for java.util.EventObject.toString() definition code for java.util.EventObject.toString()
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Field Detail

paths sample code for javax.swing.event.TreeSelectionEvent.paths

protected TreePath sample code for javax.swing.tree.TreePath definition code for javax.swing.tree.TreePath [] paths
Paths this event represents.


areNew sample code for javax.swing.event.TreeSelectionEvent.areNew

protected boolean[] areNew
For each path identifies if that is path is in fact new.


oldLeadSelectionPath sample code for javax.swing.event.TreeSelectionEvent.oldLeadSelectionPath

protected TreePath sample code for javax.swing.tree.TreePath definition code for javax.swing.tree.TreePath  oldLeadSelectionPath
leadSelectionPath before the paths changed, may be null.


newLeadSelectionPath sample code for javax.swing.event.TreeSelectionEvent.newLeadSelectionPath

protected TreePath sample code for javax.swing.tree.TreePath definition code for javax.swing.tree.TreePath  newLeadSelectionPath
leadSelectionPath after the paths changed, may be null.

Constructor Detail

TreeSelectionEvent sample code for javax.swing.event.TreeSelectionEvent(java.lang.Object, javax.swing.tree.TreePath[], boolean[], javax.swing.tree.TreePath, javax.swing.tree.TreePath) definition code for javax.swing.event.TreeSelectionEvent(java.lang.Object, javax.swing.tree.TreePath[], boolean[], javax.swing.tree.TreePath, javax.swing.tree.TreePath)

public TreeSelectionEvent(Object sample code for java.lang.Object definition code for java.lang.Object  source,
                          TreePath sample code for javax.swing.tree.TreePath definition code for javax.swing.tree.TreePath [] paths,
                          boolean[] areNew,
                          TreePath sample code for javax.swing.tree.TreePath definition code for javax.swing.tree.TreePath  oldLeadSelectionPath,
                          TreePath sample code for javax.swing.tree.TreePath definition code for javax.swing.tree.TreePath  newLeadSelectionPath)
Represents a change in the selection of a TreeSelectionModel. paths identifies the paths that have been either added or removed from the selection.

Parameters:
source - source of event
paths - the paths that have changed in the selection

TreeSelectionEvent sample code for javax.swing.event.TreeSelectionEvent(java.lang.Object, javax.swing.tree.TreePath, boolean, javax.swing.tree.TreePath, javax.swing.tree.TreePath) definition code for javax.swing.event.TreeSelectionEvent(java.lang.Object, javax.swing.tree.TreePath, boolean, javax.swing.tree.TreePath, javax.swing.tree.TreePath)

public TreeSelectionEvent(Object sample code for java.lang.Object definition code for java.lang.Object  source,
                          TreePath sample code for javax.swing.tree.TreePath definition code for javax.swing.tree.TreePath  path,
                          boolean isNew,
                          TreePath sample code for javax.swing.tree.TreePath definition code for javax.swing.tree.TreePath  oldLeadSelectionPath,
                          TreePath sample code for javax.swing.tree.TreePath definition code for javax.swing.tree.TreePath  newLeadSelectionPath)
Represents a change in the selection of a TreeSelectionModel. path identifies the path that have been either added or removed from the selection.

Parameters:
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.
Method Detail

getPaths sample code for javax.swing.event.TreeSelectionEvent.getPaths() definition code for javax.swing.event.TreeSelectionEvent.getPaths()

public TreePath sample code for javax.swing.tree.TreePath definition code for javax.swing.tree.TreePath [] getPaths()
Returns the paths that have been added or removed from the selection.


getPath sample code for javax.swing.event.TreeSelectionEvent.getPath() definition code for javax.swing.event.TreeSelectionEvent.getPath()

public TreePath sample code for javax.swing.tree.TreePath definition code for javax.swing.tree.TreePath  getPath()
Returns the first path element.


isAddedPath sample code for javax.swing.event.TreeSelectionEvent.isAddedPath() definition code for javax.swing.event.TreeSelectionEvent.isAddedPath()

public boolean isAddedPath()
Returns true if the first path element has been added to the selection, a return value of false means the first path has been removed from the selection.


isAddedPath sample code for javax.swing.event.TreeSelectionEvent.isAddedPath(javax.swing.tree.TreePath) definition code for javax.swing.event.TreeSelectionEvent.isAddedPath(javax.swing.tree.TreePath)

public boolean isAddedPath(TreePath sample code for javax.swing.tree.TreePath definition code for javax.swing.tree.TreePath  path)
Returns true if the path identified by path was added to the selection. A return value of false means the path was in the selection but is no longer in the selection. This will raise if path is not one of the paths identified by this event.


isAddedPath sample code for javax.swing.event.TreeSelectionEvent.isAddedPath(int) definition code for javax.swing.event.TreeSelectionEvent.isAddedPath(int)

public boolean isAddedPath(int index)
Returns true if the path identified by index was added to the selection. A return value of false means the path was in the selection but is no longer in the selection. This will raise if index < 0 || >= getPaths.length.

Since:
1.3

getOldLeadSelectionPath sample code for javax.swing.event.TreeSelectionEvent.getOldLeadSelectionPath() definition code for javax.swing.event.TreeSelectionEvent.getOldLeadSelectionPath()

public TreePath sample code for javax.swing.tree.TreePath definition code for javax.swing.tree.TreePath  getOldLeadSelectionPath()
Returns the path that was previously the lead path.


getNewLeadSelectionPath sample code for javax.swing.event.TreeSelectionEvent.getNewLeadSelectionPath() definition code for javax.swing.event.TreeSelectionEvent.getNewLeadSelectionPath()

public TreePath sample code for javax.swing.tree.TreePath definition code for javax.swing.tree.TreePath  getNewLeadSelectionPath()
Returns the current lead path.


cloneWithSource sample code for javax.swing.event.TreeSelectionEvent.cloneWithSource(java.lang.Object) definition code for javax.swing.event.TreeSelectionEvent.cloneWithSource(java.lang.Object)

public Object sample code for java.lang.Object definition code for java.lang.Object  cloneWithSource(Object sample code for java.lang.Object definition code for java.lang.Object  newSource)
Returns a copy of the receiver, but with the source being newSource.