|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object![]()
![]()
![]()
javax.swing.DefaultListSelectionModel
, Cloneable
, ListSelectionModel

public class DefaultListSelectionModel

, Cloneable
, Serializable

Default data model for list selections.
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 see XMLEncoder
.
ListSelectionModel
,
Serialized Form| Field Summary | |
|---|---|
protected boolean |
leadAnchorNotificationEnabled
|
protected EventListenerList |
listenerList
|
Fields inherited from interface javax.swing.ListSelectionModel ![]() |
|---|
MULTIPLE_INTERVAL_SELECTION |
| Constructor Summary | |
|---|---|
DefaultListSelectionModel
|
|
| Method Summary | ||
|---|---|---|
void |
addListSelectionListener
Add a listener to the list that's notified each time a change to the selection occurs. |
|
void |
addSelectionInterval
Change the selection to be the set union of the current selection and the indices between index0 and index1 inclusive. |
|
void |
clearSelection
Change the selection to the empty set. |
|
Object |
clone
Returns a clone of this selection model with the same selection. |
|
protected void |
fireValueChanged
Notifies listeners that we have ended a series of adjustments. |
|
protected void |
fireValueChanged
Notifies ListSelectionListeners that the value
of the selection, in the closed interval firstIndex,
lastIndex, has changed. |
|
protected void |
fireValueChanged
|
|
int |
getAnchorSelectionIndex
Return the first index argument from the most recent call to setSelectionInterval(), addSelectionInterval() or removeSelectionInterval(). |
|
int |
getLeadSelectionIndex
Return the second index argument from the most recent call to setSelectionInterval(), addSelectionInterval() or removeSelectionInterval(). |
|
|
getListeners
Returns an array of all the objects currently registered as FooListeners
upon this model. |
|
ListSelectionListener |
getListSelectionListeners
Returns an array of all the list selection listeners registered on this DefaultListSelectionModel. |
|
int |
getMaxSelectionIndex
Returns the last selected index or -1 if the selection is empty. |
|
int |
getMinSelectionIndex
Returns the first selected index or -1 if the selection is empty. |
|
int |
getSelectionMode
Returns the selection mode. |
|
boolean |
getValueIsAdjusting
Returns true if the value is undergoing a series of changes. |
|
void |
insertIndexInterval
Insert length indices beginning before/after index. |
|
boolean |
isLeadAnchorNotificationEnabled
Returns the value of the leadAnchorNotificationEnabled flag. |
|
boolean |
isSelectedIndex
Returns true if the specified index is selected. |
|
boolean |
isSelectionEmpty
Returns true if no indices are selected. |
|
void |
moveLeadSelectionIndex
Set the lead selection index, leaving all selection values unchanged. |
|
void |
removeIndexInterval
Remove the indices in the interval index0,index1 (inclusive) from the selection model. |
|
void |
removeListSelectionListener
Remove a listener from the list that's notified each time a change to the selection occurs. |
|
void |
removeSelectionInterval
Change the selection to be the set difference of the current selection and the indices between index0 and index1 inclusive. |
|
void |
setAnchorSelectionIndex
Set the anchor selection index, leaving all selection values unchanged. |
|
void |
setLeadAnchorNotificationEnabled
Sets the value of the leadAnchorNotificationEnabled flag. |
|
void |
setLeadSelectionIndex
Sets the lead selection index, ensuring that values between the anchor and the new lead are either all selected or all deselected. |
|
void |
setSelectionInterval
Change the selection to be between index0 and index1 inclusive. |
|
void |
setSelectionMode
Sets the selection mode. |
|
void |
setValueIsAdjusting
This property is true if upcoming changes to the value of the model should be considered a single event. |
|
String |
toString
Returns a string that displays and identifies this object's properties. |
|
Methods inherited from class java.lang.Object ![]() |
|---|
equals |
| Field Detail |
|---|

protected EventListenerList![]()
![]()
listenerList

protected boolean leadAnchorNotificationEnabled
| Constructor Detail |
|---|

public DefaultListSelectionModel()
| Method Detail |
|---|

public int getMinSelectionIndex()
ListSelectionModel

getMinSelectionIndex

in interface ListSelectionModel


public int getMaxSelectionIndex()
ListSelectionModel

getMaxSelectionIndex

in interface ListSelectionModel


public boolean getValueIsAdjusting()
ListSelectionModel

getValueIsAdjusting

in interface ListSelectionModel

ListSelectionModel.setValueIsAdjusting(boolean)


public int getSelectionMode()
getSelectionMode

in interface ListSelectionModel

getSelectionMode()


public void setSelectionMode(int selectionMode)
setSelectionMode

in interface ListSelectionModel

selectionMode - one of three values:
IllegalArgumentException

- if selectionMode
is not one of the legal values shown abovesetSelectionMode(int)


public boolean isSelectedIndex(int index)
ListSelectionModel

isSelectedIndex

in interface ListSelectionModel


public boolean isSelectionEmpty()
ListSelectionModel

isSelectionEmpty

in interface ListSelectionModel


public void addListSelectionListener(ListSelectionListener![]()
![]()
l)
ListSelectionModel

addListSelectionListener

in interface ListSelectionModel

l - the ListSelectionListenerListSelectionModel.removeListSelectionListener(javax.swing.event.ListSelectionListener)
,
ListSelectionModel.setSelectionInterval(int, int)
,
ListSelectionModel.addSelectionInterval(int, int)
,
ListSelectionModel.removeSelectionInterval(int, int)
,
ListSelectionModel.clearSelection()
,
ListSelectionModel.insertIndexInterval(int, int, boolean)
,
ListSelectionModel.removeIndexInterval(int, int)


public void removeListSelectionListener(ListSelectionListener![]()
![]()
l)
ListSelectionModel

removeListSelectionListener

in interface ListSelectionModel

l - the ListSelectionListenerListSelectionModel.addListSelectionListener(javax.swing.event.ListSelectionListener)


public ListSelectionListener![]()
![]()
[] getListSelectionListeners()
DefaultListSelectionModel.
ListSelectionListeners
or an empty
array if no list selection listeners are currently registeredaddListSelectionListener(javax.swing.event.ListSelectionListener)
,
removeListSelectionListener(javax.swing.event.ListSelectionListener)


protected void fireValueChanged(boolean isAdjusting)

protected void fireValueChanged(int firstIndex,
int lastIndex)
ListSelectionListeners that the value
of the selection, in the closed interval firstIndex,
lastIndex, has changed.

protected void fireValueChanged(int firstIndex,
int lastIndex,
boolean isAdjusting)
firstIndex - the first index in the intervallastIndex - the last index in the intervalisAdjusting - true if this is the final change in a series of
adjustmentsEventListenerList


public <T extends EventListener![]()
![]()
> T[] getListeners(Class
![]()
![]()
<T> listenerType)
FooListeners
upon this model.
FooListeners
are registered using the addFooListener method.
You can specify the listenerType argument
with a class literal, such as FooListener.class.
For example, you can query a DefaultListSelectionModel
instance m
for its list selection listeners
with the following code:
ListSelectionListener[] lsls = (ListSelectionListener[])(m.getListeners(ListSelectionListener.class));If no such listeners exist, this method returns an empty array.
listenerType - the type of listeners requested;
this parameter should specify an interface
that descends from java.util.EventListener
FooListeners
on this model,
or an empty array if no such
listeners have been added
ClassCastException

- if listenerType doesn't
specify a class or interface that implements
java.util.EventListenergetListSelectionListeners()


public void setLeadAnchorNotificationEnabled(boolean flag)
isLeadAnchorNotificationEnabled()

