所有类


javax.swing
类 DefaultListSelectionModel

java.lang.Object
  继承者 javax.swing.DefaultListSelectionModel
所有已实现的接口:
Serializable, Cloneable, ListSelectionModel

public class DefaultListSelectionModel
   
   
   
   
   
extends Object
implements ListSelectionModel, Cloneable, Serializable

列表选择的默认数据模型。

警告:此类的序列化对象与以后的 Swing 版本不兼容。当前序列化支持适用于短期存储,或适用于在运行相同 Swing 版本的应用程序之间进行 RMI(Remote Method Invocation,远程方法调用)。从 1.4 版本开始,已在 java.beans 包中添加了支持所有 JavaBeansTM 长期存储的功能。请参见 XMLEncoder

另请参见:
ListSelectionModel

字段摘要
protected  booleanleadAnchorNotificationEnabled
           
protected  EventListenerListlistenerList
           
 
从接口 javax.swing.ListSelectionModel 继承的字段
MULTIPLE_INTERVAL_SELECTION, SINGLE_INTERVAL_SELECTION, SINGLE_SELECTION
 
构造方法摘要
DefaultListSelectionModel()
           
 
方法摘要
 voidaddListSelectionListener(ListSelectionListener l)
          将侦听器添加到每次在选择发生更改时都得到通知的列表。
 voidaddSelectionInterval(int index0, int index1)
          将该选择更改为当前选择与 index0 和 index1(包括)之间索引的并集。
 voidclearSelection()
          将该选择更改为空集。
 Objectclone()
          返回此选择模型的具有相同选择的克隆。
protected  voidfireValueChanged(boolean isAdjusting)
          通知侦听器已经结束了一系列的调整。
protected  voidfireValueChanged(int firstIndex, int lastIndex)
          通知 ListSelectionListener 选择的值已发生更改,该值在 firstIndexlastIndex 组成的闭区间内。
protected  voidfireValueChanged(int firstIndex, int lastIndex, boolean isAdjusting)
           
 intgetAnchorSelectionIndex()
          从对 setSelectionInterval()、addSelectionInterval() 或 removeSelectionInterval() 的最近调用中返回第一个索引参数。
 intgetLeadSelectionIndex()
          从对 setSelectionInterval()、addSelectionInterval() 或 removeSelectionInterval() 的最近调用中返回第二个索引参数。
<T extends EventListener>
T[]
getListeners(Class<T> listenerType)
          返回当前已在此模型上注册为 FooListener 的所有对象组成的数组。
 ListSelectionListener[]getListSelectionListeners()
          返回已在此 DefaultListSelectionModel 上注册的所有列表选择侦听器组成的数组。
 intgetMaxSelectionIndex()
          返回最后选择的索引,如果选择为空,则返回 -1。
 intgetMinSelectionIndex()
          返回第一个选择的索引,如果选择为空,则返回 -1。
 intgetSelectionMode()
          返回选择模式。
 booleangetValueIsAdjusting()
          如果该值在进行一系列更改,则返回 true。
 voidinsertIndexInterval(int index, int length, boolean before)
          从 index 之前/之后开始插入 length 个索引。
 booleanisLeadAnchorNotificationEnabled()
          返回 leadAnchorNotificationEnabled 标志的值。
 booleanisSelectedIndex(int index)
          如果选择了指定的索引,则返回 true。
 booleanisSelectionEmpty()
          如果没有选择索引,则返回 true。
 voidmoveLeadSelectionIndex(int leadIndex)
          设置 lead 选择索引,并不作更改地保留所有选择值。
 voidremoveIndexInterval(int index0, int index1)
          从选择模型中移除 index0,index1 区间中(包括两端点)的索引。
 voidremoveListSelectionListener(ListSelectionListener l)
          将侦听器从每次在选择发生更改时都得到通知的列表中移除。
 voidremoveSelectionInterval(int index0, int index1)
          将该选择更改为当前选择与 index0 和 index1(包括)之间索引的差集。
 voidsetAnchorSelectionIndex(int anchorIndex)
          设置 anchor 选择索引,并不作更改地保留所有选择值。
 voidsetLeadAnchorNotificationEnabled(boolean flag)
          设置 leadAnchorNotificationEnabled 标志的值。
 voidsetLeadSelectionIndex(int leadIndex)
          设置 lead 选择索引,确保 anchor 和新 lead 之间的值要么全部被选定,要么全部被取消选定。
 voidsetSelectionInterval(int index0, int index1)
          更改要位于 index0 和 index1(包括)之间的选择。
 voidsetSelectionMode(int selectionMode)
          设置选择模式。
 voidsetValueIsAdjusting(boolean isAdjusting)
          如果将来对该模型的值的更改被视为单个事件,则此属性为 true。
 StringtoString()
          返回显示并标识此对象的属性的字符串。
 
从类 java.lang.Object 继承的方法
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

字段详细信息

listenerList

protected EventListenerList listenerList

leadAnchorNotificationEnabled

protected boolean leadAnchorNotificationEnabled
构造方法详细信息

DefaultListSelectionModel

public DefaultListSelectionModel()
方法详细信息

getMinSelectionIndex

public int getMinSelectionIndex()
从接口 ListSelectionModel 复制的描述
返回第一个选择的索引,如果选择为空,则返回 -1。

指定者:
接口 ListSelectionModel 中的 getMinSelectionIndex

getMaxSelectionIndex

public int getMaxSelectionIndex()
从接口 ListSelectionModel 复制的描述
返回最后选择的索引,如果选择为空,则返回 -1。

指定者:
接口 ListSelectionModel 中的 getMaxSelectionIndex

getValueIsAdjusting

public boolean getValueIsAdjusting()
从接口 ListSelectionModel 复制的描述
如果该值在进行一系列更改,则返回 true。

指定者:
接口 ListSelectionModel 中的 getValueIsAdjusting
返回:
如果正在调整该值,则返回 true
另请参见:
ListSelectionModel.setValueIsAdjusting(boolean)

getSelectionMode

public int getSelectionMode()
返回选择模式。

指定者:
接口 ListSelectionModel 中的 getSelectionMode
返回:
以下这些值之一:
  • SINGLE_SELECTION
  • SINGLE_INTERVAL_SELECTION
  • MULTIPLE_INTERVAL_SELECTION
另请参见:
getSelectionMode()

setSelectionMode

public void setSelectionMode(int selectionMode)
设置选择模式。默认值是 MULTIPLE_INTERVAL_SELECTION。

指定者:
接口 ListSelectionModel 中的 setSelectionMode
参数:
selectionMode - 以下三个值之一:
  • SINGLE_SELECTION
  • SINGLE_INTERVAL_SELECTION
  • MULTIPLE_INTERVAL_SELECTION
抛出:
IllegalArgumentException - 如果 selectionMode 不是上面显示的合法值之一
另请参见:
setSelectionMode(int)

isSelectedIndex

public boolean isSelectedIndex(int index)
从接口 ListSelectionModel 复制的描述
如果选择了指定的索引,则返回 true。

指定者:
接口 ListSelectionModel 中的 isSelectedIndex