public interface ListSelectionModel
Modifier and Type | Field and Description |
---|---|
static int |
MULTIPLE_INTERVAL_SELECTION
对于SelectionMode属性设置为一个值:选择一个或多个在一个时间指标的连续范围。
|
static int |
SINGLE_INTERVAL_SELECTION
对于SelectionMode属性设置为一个值:在一个时间选择指标连续范围。
|
static int |
SINGLE_SELECTION
对于SelectionMode属性设置为一个值:每次选择一个列表索引。
|
Modifier and Type | Method and Description |
---|---|
void |
addListSelectionListener(ListSelectionListener x)
向列表中添加一个侦听器,该列表在每次更改时都会通知该列表的更改。
|
void |
addSelectionInterval(int index0, int index1)
变化的选择是当前选择的并集和
index0 和
index1 包容之间的指标。
|
void |
clearSelection()
将选择更改为空集。
|
int |
getAnchorSelectionIndex()
返回最近调用第一个指标参数setselectioninterval(),addselectioninterval()或removeselectioninterval()。
|
int |
getLeadSelectionIndex()
返回最近调用二指标参数setselectioninterval(),addselectioninterval()或removeselectioninterval()。
|
int |
getMaxSelectionIndex()
如果选择是空的,则返回最后一个选择的索引或- 1。
|
int |
getMinSelectionIndex()
如果选择是空的,则返回第一个选择的索引或- 1。
|
int |
getSelectionMode()
返回当前选择模式。
|
boolean |
getValueIsAdjusting()
返回
true 如果选择正在发生一系列的变化。
|
void |
insertIndexInterval(int index, int length, boolean before)
插入长度指数开始前/后指数。
|
boolean |
isSelectedIndex(int index)
如果选择指定索引,则返回真。
|
boolean |
isSelectionEmpty()
如果没有选择索引,则返回真。
|
void |
removeIndexInterval(int index0, int index1)
除去在区间index0指数,指数(含)的选择模型。
|
void |
removeListSelectionListener(ListSelectionListener x)
从所通知的列表中删除一个侦听器,每次更改到选择时发生。
|
void |
removeSelectionInterval(int index0, int index1)
变化的选择是当前选择的差集和指标之间的
index0 和
index1 包容。
|
void |
setAnchorSelectionIndex(int index)
设置锚定选择索引。
|
void |
setLeadSelectionIndex(int index)
设置引线选择索引。
|
void |
setSelectionInterval(int index0, int index1)
变化的选择之间是
index0 和
index1 包容。
|
void |
setSelectionMode(int selectionMode)
设置选择模式。
|
void |
setValueIsAdjusting(boolean valueIsAdjusting)
集
valueIsAdjusting 属性,它指示是否即将到来的选择变化应该被视为一个单一的变化部分。
|
static final int SINGLE_SELECTION
static final int SINGLE_INTERVAL_SELECTION
static final int MULTIPLE_INTERVAL_SELECTION
void setSelectionInterval(int index0, int index1)
index0
和
index1
包容。
index0
不应小于或等于
index1
在SINGLE_SELECTION
选择模式,只有二指标应用。
如果这是一个改变当前的选择,然后每个ListSelectionListener
是更改的通知。
index0
-区间的一端。
index1
-区间的另一端
addListSelectionListener(javax.swing.event.ListSelectionListener)
void addSelectionInterval(int index0, int index1)
index0
和
index1
包容之间的指标。
index0
不应小于或等于
index1
。
在SINGLE_SELECTION
选择模式,这相当于调用setSelectionInterval
,只有二指标应用。在SINGLE_INTERVAL_SELECTION
选择模式,这种方法就像setSelectionInterval
,除非给出的区间是相邻或重叠存在的选择,因此可以用来种植的选择。
如果这是一个改变当前的选择,然后每个ListSelectionListener
是更改的通知。
index0
-区间的一端。
index1
-区间的另一端
addListSelectionListener(javax.swing.event.ListSelectionListener)
,
setSelectionInterval(int, int)
void removeSelectionInterval(int index0, int index1)
index0
和
index1
包容。
index0
不应小于或等于
index1
在SINGLE_INTERVAL_SELECTION
选择模式,如果去除会产生两个不相交的选择,去除是通过选择更大的一端延伸。例如,如果选择的是0-10
你供应指标5,6
(按任何顺序)所产生的选择是0-4
。
如果这是一个改变当前的选择,然后每个ListSelectionListener
是更改的通知。
index0
-区间的一端。
index1
-区间的另一端
addListSelectionListener(javax.swing.event.ListSelectionListener)
int getMinSelectionIndex()
int getMaxSelectionIndex()
boolean isSelectedIndex(int index)
int getAnchorSelectionIndex()
void setAnchorSelectionIndex(int index)
int getLeadSelectionIndex()
void setLeadSelectionIndex(int index)
getLeadSelectionIndex()
void clearSelection()
boolean isSelectionEmpty()
void insertIndexInterval(int index, int length, boolean before)
void removeIndexInterval(int index0, int index1)
void setValueIsAdjusting(boolean valueIsAdjusting)
valueIsAdjusting
属性,它指示是否即将到来的选择变化应该被视为一个单一的变化部分。此属性的值用于初始化所产生的
ListSelectionEvent
s的
valueIsAdjusting
财产。
例如,如果选择的是响应用户拖动更新,这个属性可以设置为true
当拖启动和设置false
当拖完。在拖动,听众接收事件与valueIsAdjusting
属性设置为true
。在拖到年底,当变化完成,听众接收事件设置为false
价值。听众可以使用这个模式,如果他们想更新只有当改变已经敲定。
将此属性设置为true
开始了一系列的变化,被认为是一个单一的变化部分。当属性被改回false
,事件发出表征整个选择的改变(如果有),与事件的valueIsAdjusting
属性设置为false
。
valueIsAdjusting
-新的属性值
getValueIsAdjusting()
,
ListSelectionEvent.getValueIsAdjusting()
boolean getValueIsAdjusting()
true
如果选择正在发生一系列的变化。
setValueIsAdjusting(boolean)
void setSelectionMode(int selectionMode)
ListSelectionModel.SINGLE_SELECTION
-只有一个列表索引一次可以选择。在这种模式下,setSelectionInterval
和addSelectionInterval
是等效的,取代当前的选择由第二个参数表示的指数(“领导”)。ListSelectionModel.SINGLE_INTERVAL_SELECTION
-只有一个连续的时间间隔一次可以选择。在这种模式下,addSelectionInterval
像setSelectionInterval
(替换当前选择),除非给定的时间间隔是相邻或重叠存在的选择,因此可以用来种植它。ListSelectionModel.MULTIPLE_INTERVAL_SELECTION
-在这种模式下,有什么可以选择无限制。IllegalArgumentException
如果选择模式并不是那种允许
getSelectionMode()
int getSelectionMode()
setSelectionMode(int)
void addListSelectionListener(ListSelectionListener x)
void removeListSelectionListener(ListSelectionListener x)
x
- ListSelectionListener
addListSelectionListener(javax.swing.event.ListSelectionListener)
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.