- java.lang.Object
-
- java.util.EventObject
-
- javax.swing.event.TreeSelectionEvent
-
- All Implemented Interfaces:
- Serializable
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 JavaBeansTM has been added to the
java.beans
package. Please seeXMLEncoder
.- See Also:
TreeSelectionListener
,TreeSelectionModel
-
-
Field Summary
Fields 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.-
Fields inherited from class java.util.EventObject
source
-
-
Constructor Summary
Constructors Constructor and 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.
-
Method Summary
Methods Modifier and Type Method and 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 bygetPath
was added to the selection.boolean
isAddedPath(int index)
Returns whether the path atgetPaths()[index]
was added to the selection.boolean
isAddedPath(TreePath path)
Returns whether the specified path was added to the selection.
-
-
-
Field Detail
-
paths
protected TreePath[] paths
Paths this event represents.
-
areNew
protected boolean[] areNew
For each path identifies if that path is in fact new.
-
oldLeadSelectionPath
protected TreePath oldLeadSelectionPath
leadSelectionPath before the paths changed, may be null.
-
newLeadSelectionPath
protected TreePath newLeadSelectionPath
leadSelectionPath after the paths changed, may be null.
-
-
Constructor Detail
-
TreeSelectionEvent
public TreeSelectionEvent(Object source, TreePath[] paths, boolean[] areNew, TreePath oldLeadSelectionPath, 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 eventpaths
- the paths that have changed in the selection
-
TreeSelectionEvent
public TreeSelectionEvent(Object source, TreePath path, boolean isNew, TreePath oldLeadSelectionPath, 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 eventpath
- the path that has changed in the selectionisNew
- whether or not the path is new to the selection, false means path was removed from the selection.
-
-
Method Detail
-
getPaths
public TreePath[] getPaths()
Returns the paths that have been added or removed from the selection.
-
getPath
public TreePath getPath()
Returns the first path element.
-
isAddedPath
public boolean isAddedPath()
Returns whether the path identified bygetPath
was added to the selection. A return value oftrue
indicates the path identified bygetPath
was added to the selection. A return value offalse
indicatesgetPath
was selected, but is no longer selected.- Returns:
true
ifgetPath
was added to the selection,false
otherwise
-
isAddedPath
public boolean isAddedPath(TreePath path)
Returns whether the specified path was added to the selection. A return value oftrue
indicates the path identified bypath
was added to the selection. A return value offalse
indicatespath
is no longer selected. This method is only valid for the paths returned fromgetPaths()
; invoking with a path not included ingetPaths()
throws anIllegalArgumentException
.- Parameters:
path
- the path to test- Returns:
true
ifpath
was added to the selection,false
otherwise- Throws:
IllegalArgumentException
- ifpath
is not contained ingetPaths
- See Also:
getPaths()
-
isAddedPath
public boolean isAddedPath(int index)
Returns whether the path atgetPaths()[index]
was added to the selection. A return value oftrue
indicates the path was added to the selection. A return value offalse
indicates the path is no longer selected.- Parameters:
index
- the index of the path to test- Returns:
true
if the path was added to the selection,false
otherwise- Throws:
IllegalArgumentException
- if index is outside the range ofgetPaths
- Since:
- 1.3
- See Also:
getPaths()
-
getOldLeadSelectionPath
public TreePath getOldLeadSelectionPath()
Returns the path that was previously the lead path.
-
getNewLeadSelectionPath
public TreePath getNewLeadSelectionPath()
Returns the current lead path.
-
-
Deutsche Übersetzung
Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.
Vielen Dank im Voraus.
Dokument erstellt 11/06/2005, zuletzt geändert 04/03/2020
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-rf-javax/swing/event/treeselectionevent.html
Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.
Referenzen
Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor Diese Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.