- java.lang.Object
-
- java.util.EventObject
-
- javax.swing.event.TreeSelectionEvent
-
- 实现的所有接口
-
Serializable
public class TreeSelectionEvent extends EventObject
表示当前选择更改的事件。 此更改基于任意数量的路径。 TreeSelectionListeners通常会查询事件的来源,以查找每个可能更改的行的新选定状态。警告:此类的序列化对象与以后的Swing版本不兼容。 当前的序列化支持适用于运行相同版本Swing的应用程序之间的短期存储或RMI。 从1.4开始,
java.beans软件包中添加了对所有JavaBeansjava.beans长期存储的支持。 请参阅XMLEncoder。
-
-
字段汇总
字段 变量和类型 字段 描述 protected boolean[]areNew对于每个路径,标识该路径实际上是否为新路径。protected TreePathnewLeadSelectionPath路径更改后的leadSelectionPath可能为null。protected TreePatholdLeadSelectionPath路径更改前的leadSelectionPath可能为null。protected TreePath[]paths此事件表示的路径。-
声明的属性在类 java.util.EventObject
source
-
-
构造方法摘要
构造方法 构造器 描述 TreeSelectionEvent(Object source, TreePath[] paths, boolean[] areNew, TreePath oldLeadSelectionPath, TreePath newLeadSelectionPath)表示选择TreeSelectionModel。TreeSelectionEvent(Object source, TreePath path, boolean isNew, TreePath oldLeadSelectionPath, TreePath newLeadSelectionPath)表示选择TreeSelectionModel。
-
方法摘要
所有方法 实例方法 具体的方法 变量和类型 方法 描述 ObjectcloneWithSource(Object newSource)返回接收者的副本,但源为newSource。TreePathgetNewLeadSelectionPath()返回当前的潜在客户路径。TreePathgetOldLeadSelectionPath()返回先前为前导路径的路径。TreePathgetPath()返回第一个路径元素。TreePath[]getPaths()返回已从选择中添加或删除的路径。booleanisAddedPath()返回getPath标识的路径是否已添加到选择中。booleanisAddedPath(int index)返回是否将getPaths()[index]处的路径添加到选择中。booleanisAddedPath(TreePath path)返回指定的路径是否已添加到选择中。-
声明方法的类 java.util.EventObject
getSource, toString
-
-
-
-
构造方法详细信息
-
TreeSelectionEvent
public TreeSelectionEvent(Object source, TreePath[] paths, boolean[] areNew, TreePath oldLeadSelectionPath, TreePath newLeadSelectionPath)
表示选择TreeSelectionModel。paths标识已从选择中添加或删除的路径。- 参数
-
source- 活动来源 -
paths- 选择中已更改的路径 -
areNew- 一个boolean数组,指示paths中的路径是否为选择的新路径 -
oldLeadSelectionPath- 先前的潜在客户选择路径 -
newLeadSelectionPath- 新的潜在客户选择路径
-
TreeSelectionEvent
public TreeSelectionEvent(Object source, TreePath path, boolean isNew, TreePath oldLeadSelectionPath, TreePath newLeadSelectionPath)
表示选择TreeSelectionModel。path标识已从选择中添加或删除的路径。- 参数
-
source- 活动来源 -
path- 选择中已更改的路径 -
isNew- 路径是否为选择的新路径,false表示路径已从选择中删除。 -
oldLeadSelectionPath- 先前的潜在客户选择路径 -
newLeadSelectionPath- 新的潜在客户选择路径
-
-
方法详细信息
-
getPaths
public TreePath[] getPaths()
返回已从选择中添加或删除的路径。- 结果
-
此事件的
TreePath数组的副本。
-
getPath
public TreePath getPath()
返回第一个路径元素。- 结果
-
此事件代表的第一个
TreePath元素
-
isAddedPath
public boolean isAddedPath()
返回getPath标识的路径是否已添加到选择中。 返回值true表示getPath标识的路径已添加到选择中。 返回值false表示已选择getPath,但不再选中。- 结果
-
true如果getPath已添加到选择中,否则为false
-
isAddedPath
public boolean isAddedPath(TreePath path)
返回指定的路径是否已添加到选择中。 返回值true表示path标识的路径已添加到选择中。 返回值false表示不再选择path。 此方法仅对从getPaths()返回的路径有效; 使用getPaths()未包含的路径调用将引发IllegalArgumentException。- 参数
-
path- 要测试的路径 - 结果
-
true如果path已添加到选择中,否则为false - 异常
-
IllegalArgumentException- 如果path未包含getPaths - 另请参见:
-
getPaths()
-
isAddedPath
public boolean isAddedPath(int index)
返回是否将getPaths()[index]处的路径添加到选择中。 返回值true表示路径已添加到选择中。 返回值false表示不再选择路径。- 参数
-
index- 要测试的路径的索引 - 结果
-
true如果路径已添加到选择中,false - 异常
-
IllegalArgumentException- 如果index超出getPaths的范围 - 从以下版本开始:
- 1.3
- 另请参见:
-
getPaths()
-
getOldLeadSelectionPath
public TreePath getOldLeadSelectionPath()
返回先前为前导路径的路径。- 结果
-
TreePath包含旧的引导选择路径
-
getNewLeadSelectionPath
public TreePath getNewLeadSelectionPath()
返回当前的潜在客户路径。- 结果
-
a
TreePath包含新的潜在客户选择路径
-
-