public class TreeSelectionEvent extends EventObject
警告:此类的序列化对象与将来的Swing版本不兼容。 当前的序列化支持适用于运行相同版本的Swing的应用程序之间的短期存储或RMI。 从1.4开始,对所有JavaBeans的长期存储的支持已被添加到java.beans包中。 请参阅XMLEncoder 。
| Modifier and Type | Field and Description |
|---|---|
protected boolean[] |
areNew
对于每个路径,标识该路径实际上是新的。
|
protected TreePath |
newLeadSelectionPath
leadSelectionPath在路径更改后可能为null。
|
protected TreePath |
oldLeadSelectionPath
leadSelectionPath在路径更改之前,可能为null。
|
protected TreePath[] |
paths
此事件代表的路径。
|
source| Constructor and Description |
|---|
TreeSelectionEvent(Object source, TreePath[] paths, boolean[] areNew, TreePath oldLeadSelectionPath, TreePath newLeadSelectionPath)
表示对TreeSelectionModel选择的更改。
|
TreeSelectionEvent(Object source, TreePath path, boolean isNew, TreePath oldLeadSelectionPath, TreePath newLeadSelectionPath)
表示对TreeSelectionModel选择的更改。
|
| Modifier and Type | Method and Description |
|---|---|
Object |
cloneWithSource(Object newSource)
返回接收者的副本,但源代码是newSource。
|
TreePath |
getNewLeadSelectionPath()
返回当前引导路径。
|
TreePath |
getOldLeadSelectionPath()
返回先前是引导路径的路径。
|
TreePath |
getPath()
返回第一个路径元素。
|
TreePath[] |
getPaths()
返回从选择中添加或删除的路径。
|
boolean |
isAddedPath()
返回由确定的路径是否
getPath加入到选择。
|
boolean |
isAddedPath(int index)
返回是否将
getPaths()[index]的路径添加到选择。
|
boolean |
isAddedPath(TreePath path)
返回指定的路径是否添加到选择。
|
getSource, toStringprotected TreePath[] paths
protected boolean[] areNew
protected TreePath oldLeadSelectionPath
protected TreePath newLeadSelectionPath
public TreeSelectionEvent(Object source, TreePath[] paths, boolean[] areNew, TreePath oldLeadSelectionPath, TreePath newLeadSelectionPath)
source - 事件来源
paths - 选择中已更改的路径
public TreePath[] getPaths()
public TreePath getPath()
public boolean isAddedPath()
getPath的路径是否添加到选择。
的返回值true表示由标识的路径getPath加入到该选择。
返回值为false表示getPath选择,但不再选择。
true如果
getPath被添加到选择,
false否则
public boolean isAddedPath(TreePath path)
true表示由标识的路径path加入到该选择。
返回值为false表示path不再被选中。
此方法仅适用于从getPaths()返回的路径;
调用一个没有包含在getPaths()的路径抛出一个IllegalArgumentException 。
path - 测试的路径
true如果
path被添加到选择,
false否则
IllegalArgumentException - 如果
path不包含在
getPaths
getPaths()
public boolean isAddedPath(int index)
getPaths()[index]的路径是否添加到选择。
返回值为true表示路径被添加到选择。
返回值为false表示不再选择路径。
index - 测试路径的索引
true如果路径被添加到选择,
false false
IllegalArgumentException - 如果索引超出了
getPaths的范围
getPaths()
public TreePath getOldLeadSelectionPath()
public TreePath getNewLeadSelectionPath()
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.