javax.swing
Class DefaultListSelectionModel

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.swing.DefaultListSelectionModel
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable , Cloneable sample code for java.lang.Cloneable definition code for java.lang.Cloneable , ListSelectionModel sample code for javax.swing.ListSelectionModel definition code for javax.swing.ListSelectionModel

public class DefaultListSelectionModel
extends Object sample code for java.lang.Object definition code for java.lang.Object
implements ListSelectionModel sample code for javax.swing.ListSelectionModel definition code for javax.swing.ListSelectionModel , Cloneable sample code for java.lang.Cloneable definition code for java.lang.Cloneable , Serializable sample code for java.io.Serializable definition code for java.io.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 sample code for java.beans.XMLEncoder definition code for java.beans.XMLEncoder .

See Also:
ListSelectionModel sample code for javax.swing.ListSelectionModel definition code for javax.swing.ListSelectionModel , Serialized Form

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

Field Detail

listenerList sample code for javax.swing.DefaultListSelectionModel.listenerList

protected EventListenerList sample code for javax.swing.event.EventListenerList definition code for javax.swing.event.EventListenerList  listenerList

leadAnchorNotificationEnabled sample code for javax.swing.DefaultListSelectionModel.leadAnchorNotificationEnabled

protected boolean leadAnchorNotificationEnabled
Constructor Detail

DefaultListSelectionModel sample code for javax.swing.DefaultListSelectionModel() definition code for javax.swing.DefaultListSelectionModel()

public DefaultListSelectionModel()
Method Detail

getMinSelectionIndex sample code for javax.swing.DefaultListSelectionModel.getMinSelectionIndex() definition code for javax.swing.DefaultListSelectionModel.getMinSelectionIndex()

public int getMinSelectionIndex()
Description copied from interface: ListSelectionModel sample code for javax.swing.ListSelectionModel.getMinSelectionIndex() definition code for javax.swing.ListSelectionModel.getMinSelectionIndex()
Returns the first selected index or -1 if the selection is empty.

Specified by:
getMinSelectionIndex sample code for javax.swing.ListSelectionModel.getMinSelectionIndex() definition code for javax.swing.ListSelectionModel.getMinSelectionIndex() in interface ListSelectionModel sample code for javax.swing.ListSelectionModel definition code for javax.swing.ListSelectionModel

getMaxSelectionIndex sample code for javax.swing.DefaultListSelectionModel.getMaxSelectionIndex() definition code for javax.swing.DefaultListSelectionModel.getMaxSelectionIndex()

public int getMaxSelectionIndex()
Description copied from interface: ListSelectionModel sample code for javax.swing.ListSelectionModel.getMaxSelectionIndex() definition code for javax.swing.ListSelectionModel.getMaxSelectionIndex()
Returns the last selected index or -1 if the selection is empty.

Specified by:
getMaxSelectionIndex sample code for javax.swing.ListSelectionModel.getMaxSelectionIndex() definition code for javax.swing.ListSelectionModel.getMaxSelectionIndex() in interface ListSelectionModel sample code for javax.swing.ListSelectionModel definition code for javax.swing.ListSelectionModel

getValueIsAdjusting sample code for javax.swing.DefaultListSelectionModel.getValueIsAdjusting() definition code for javax.swing.DefaultListSelectionModel.getValueIsAdjusting()

public boolean getValueIsAdjusting()
Description copied from interface: ListSelectionModel sample code for javax.swing.ListSelectionModel.getValueIsAdjusting() definition code for javax.swing.ListSelectionModel.getValueIsAdjusting()
Returns true if the value is undergoing a series of changes.

Specified by:
getValueIsAdjusting sample code for javax.swing.ListSelectionModel.getValueIsAdjusting() definition code for javax.swing.ListSelectionModel.getValueIsAdjusting() in interface ListSelectionModel sample code for javax.swing.ListSelectionModel definition code for javax.swing.ListSelectionModel
Returns:
true if the value is currently adjusting
See Also:
ListSelectionModel.setValueIsAdjusting(boolean) sample code for javax.swing.ListSelectionModel.setValueIsAdjusting(boolean) definition code for javax.swing.ListSelectionModel.setValueIsAdjusting(boolean)

getSelectionMode sample code for javax.swing.DefaultListSelectionModel.getSelectionMode() definition code for javax.swing.DefaultListSelectionModel.getSelectionMode()

public int getSelectionMode()
Returns the selection mode.

Specified by:
getSelectionMode sample code for javax.swing.ListSelectionModel.getSelectionMode() definition code for javax.swing.ListSelectionModel.getSelectionMode() in interface ListSelectionModel sample code for javax.swing.ListSelectionModel definition code for javax.swing.ListSelectionModel
Returns:
one of the these values:
  • SINGLE_SELECTION
  • SINGLE_INTERVAL_SELECTION
  • MULTIPLE_INTERVAL_SELECTION
See Also:
getSelectionMode() sample code for javax.swing.DefaultListSelectionModel.getSelectionMode() definition code for javax.swing.DefaultListSelectionModel.getSelectionMode()

setSelectionMode sample code for javax.swing.DefaultListSelectionModel.setSelectionMode(int) definition code for javax.swing.DefaultListSelectionModel.setSelectionMode(int)

public void setSelectionMode(int selectionMode)
Sets the selection mode. The default is MULTIPLE_INTERVAL_SELECTION.

Specified by:
setSelectionMode sample code for javax.swing.ListSelectionModel.setSelectionMode(int) definition code for javax.swing.ListSelectionModel.setSelectionMode(int) in interface ListSelectionModel sample code for javax.swing.ListSelectionModel definition code for javax.swing.ListSelectionModel
Parameters:
selectionMode - one of three values:
  • SINGLE_SELECTION
  • SINGLE_INTERVAL_SELECTION
  • MULTIPLE_INTERVAL_SELECTION
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if selectionMode is not one of the legal values shown above
See Also:
setSelectionMode(int) sample code for javax.swing.DefaultListSelectionModel.setSelectionMode(int) definition code for javax.swing.DefaultListSelectionModel.setSelectionMode(int)

isSelectedIndex sample code for javax.swing.DefaultListSelectionModel.isSelectedIndex(int) definition code for javax.swing.DefaultListSelectionModel.isSelectedIndex(int)

public boolean isSelectedIndex(int index)
Description copied from interface: ListSelectionModel sample code for javax.swing.ListSelectionModel.isSelectedIndex(int) definition code for javax.swing.ListSelectionModel.isSelectedIndex(int)
Returns true if the specified index is selected.

Specified by:
isSelectedIndex sample code for javax.swing.ListSelectionModel.isSelectedIndex(int) definition code for javax.swing.ListSelectionModel.isSelectedIndex(int) in interface ListSelectionModel sample code for javax.swing.ListSelectionModel definition code for javax.swing.ListSelectionModel

isSelectionEmpty sample code for javax.swing.DefaultListSelectionModel.isSelectionEmpty() definition code for javax.swing.DefaultListSelectionModel.isSelectionEmpty()

public boolean isSelectionEmpty()
Description copied from interface: ListSelectionModel sample code for javax.swing.ListSelectionModel.isSelectionEmpty() definition code for javax.swing.ListSelectionModel.isSelectionEmpty()
Returns true if no indices are selected.

Specified by:
isSelectionEmpty sample code for javax.swing.ListSelectionModel.isSelectionEmpty() definition code for javax.swing.ListSelectionModel.isSelectionEmpty() in interface ListSelectionModel sample code for javax.swing.ListSelectionModel definition code for javax.swing.ListSelectionModel

addListSelectionListener sample code for javax.swing.DefaultListSelectionModel.addListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.DefaultListSelectionModel.addListSelectionListener(javax.swing.event.ListSelectionListener)

public void addListSelectionListener(ListSelectionListener sample code for javax.swing.event.ListSelectionListener definition code for javax.swing.event.ListSelectionListener  l)
Description copied from interface: ListSelectionModel sample code for javax.swing.ListSelectionModel.addListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.ListSelectionModel.addListSelectionListener(javax.swing.event.ListSelectionListener)
Add a listener to the list that's notified each time a change to the selection occurs.

Specified by:
addListSelectionListener sample code for javax.swing.ListSelectionModel.addListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.ListSelectionModel.addListSelectionListener(javax.swing.event.ListSelectionListener) in interface ListSelectionModel sample code for javax.swing.ListSelectionModel definition code for javax.swing.ListSelectionModel
Parameters:
l - the ListSelectionListener
See Also:
ListSelectionModel.removeListSelectionListener(javax.swing.event.ListSelectionListener) sample code for javax.swing.ListSelectionModel.removeListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.ListSelectionModel.removeListSelectionListener(javax.swing.event.ListSelectionListener) , ListSelectionModel.setSelectionInterval(int, int) sample code for javax.swing.ListSelectionModel.setSelectionInterval(int, int) definition code for javax.swing.ListSelectionModel.setSelectionInterval(int, int) , ListSelectionModel.addSelectionInterval(int, int) sample code for javax.swing.ListSelectionModel.addSelectionInterval(int, int) definition code for javax.swing.ListSelectionModel.addSelectionInterval(int, int) , ListSelectionModel.removeSelectionInterval(int, int) sample code for javax.swing.ListSelectionModel.removeSelectionInterval(int, int) definition code for javax.swing.ListSelectionModel.removeSelectionInterval(int, int) , ListSelectionModel.clearSelection() sample code for javax.swing.ListSelectionModel.clearSelection() definition code for javax.swing.ListSelectionModel.clearSelection() , ListSelectionModel.insertIndexInterval(int, int, boolean) sample code for javax.swing.ListSelectionModel.insertIndexInterval(int, int, boolean) definition code for javax.swing.ListSelectionModel.insertIndexInterval(int, int, boolean) , ListSelectionModel.removeIndexInterval(int, int) sample code for javax.swing.ListSelectionModel.removeIndexInterval(int, int) definition code for javax.swing.ListSelectionModel.removeIndexInterval(int, int)

removeListSelectionListener sample code for javax.swing.DefaultListSelectionModel.removeListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.DefaultListSelectionModel.removeListSelectionListener(javax.swing.event.ListSelectionListener)

public void removeListSelectionListener(ListSelectionListener sample code for javax.swing.event.ListSelectionListener definition code for javax.swing.event.ListSelectionListener  l)
Description copied from interface: ListSelectionModel sample code for javax.swing.ListSelectionModel.removeListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.ListSelectionModel.removeListSelectionListener(javax.swing.event.ListSelectionListener)
Remove a listener from the list that's notified each time a change to the selection occurs.

Specified by:
removeListSelectionListener sample code for javax.swing.ListSelectionModel.removeListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.ListSelectionModel.removeListSelectionListener(javax.swing.event.ListSelectionListener) in interface ListSelectionModel sample code for javax.swing.ListSelectionModel definition code for javax.swing.ListSelectionModel
Parameters:
l - the ListSelectionListener
See Also:
ListSelectionModel.addListSelectionListener(javax.swing.event.ListSelectionListener) sample code for javax.swing.ListSelectionModel.addListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.ListSelectionModel.addListSelectionListener(javax.swing.event.ListSelectionListener)

getListSelectionListeners sample code for javax.swing.DefaultListSelectionModel.getListSelectionListeners() definition code for javax.swing.DefaultListSelectionModel.getListSelectionListeners()

public ListSelectionListener sample code for javax.swing.event.ListSelectionListener definition code for javax.swing.event.ListSelectionListener [] getListSelectionListeners()
Returns an array of all the list selection listeners registered on this DefaultListSelectionModel.

Returns:
all of this model's ListSelectionListeners or an empty array if no list selection listeners are currently registered
Since:
1.4
See Also:
addListSelectionListener(javax.swing.event.ListSelectionListener) sample code for javax.swing.DefaultListSelectionModel.addListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.DefaultListSelectionModel.addListSelectionListener(javax.swing.event.ListSelectionListener) , removeListSelectionListener(javax.swing.event.ListSelectionListener) sample code for javax.swing.DefaultListSelectionModel.removeListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.DefaultListSelectionModel.removeListSelectionListener(javax.swing.event.ListSelectionListener)

fireValueChanged sample code for javax.swing.DefaultListSelectionModel.fireValueChanged(boolean) definition code for javax.swing.DefaultListSelectionModel.fireValueChanged(boolean)

protected void fireValueChanged(boolean isAdjusting)
Notifies listeners that we have ended a series of adjustments.


fireValueChanged sample code for javax.swing.DefaultListSelectionModel.fireValueChanged(int, int) definition code for javax.swing.DefaultListSelectionModel.fireValueChanged(int, int)

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


fireValueChanged sample code for javax.swing.DefaultListSelectionModel.fireValueChanged(int, int, boolean) definition code for javax.swing.DefaultListSelectionModel.fireValueChanged(int, int, boolean)

protected void fireValueChanged(int firstIndex,
                                int lastIndex,
                                boolean isAdjusting)
Parameters:
firstIndex - the first index in the interval
lastIndex - the last index in the interval
isAdjusting - true if this is the final change in a series of adjustments
See Also:
EventListenerList sample code for javax.swing.event.EventListenerList definition code for javax.swing.event.EventListenerList

getListeners sample code for javax.swing.DefaultListSelectionModel.<T extends java.util.EventListener>getListeners(java.lang.Class<T>) definition code for javax.swing.DefaultListSelectionModel.<T extends java.util.EventListener>getListeners(java.lang.Class<T>)

public <T extends EventListener sample code for java.util.EventListener definition code for java.util.EventListener > T[] getListeners(Class sample code for java.lang.Class definition code for java.lang.Class <T> listenerType)
Returns an array of all the objects currently registered as 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.

Parameters:
listenerType - the type of listeners requested; this parameter should specify an interface that descends from java.util.EventListener
Returns:
an array of all objects registered as FooListeners on this model, or an empty array if no such listeners have been added
Throws:
ClassCastException sample code for java.lang.ClassCastException definition code for java.lang.ClassCastException - if listenerType doesn't specify a class or interface that implements java.util.EventListener
Since:
1.3
See Also:
getListSelectionListeners() sample code for javax.swing.DefaultListSelectionModel.getListSelectionListeners() definition code for javax.swing.DefaultListSelectionModel.getListSelectionListeners()

setLeadAnchorNotificationEnabled sample code for javax.swing.DefaultListSelectionModel.setLeadAnchorNotificationEnabled(boolean) definition code for javax.swing.DefaultListSelectionModel.setLeadAnchorNotificationEnabled(boolean)

public void setLeadAnchorNotificationEnabled(boolean flag)
Sets the value of the leadAnchorNotificationEnabled flag.

See Also:
isLeadAnchorNotificationEnabled() sample code for javax.swing.DefaultListSelectionModel.isLeadAnchorNotificationEnabled() definition code for javax.swing.DefaultListSelectionModel.isLeadAnchorNotificationEnabled()

isLeadAnchorNotificationEnabled sample code for javax.swing.DefaultListSelectionModel.isLeadAnchorNotificationEnabled() definition code for javax.swing.DefaultListSelectionModel.isLeadAnchorNotificationEnabled()

public boolean isLeadAnchorNotificationEnabled()
Returns the value of the leadAnchorNotificationEnabled flag. When leadAnchorNotificationEnabled is true the model generates notification events with bounds that cover all the changes to the selection plus the changes to the lead and anchor indices. Setting the flag to false causes a narrowing of the event's bounds to include only the elements that have been selected or deselected since the last change. Either way, the model continues to maintain the lead and anchor variables internally. The default is true.

Note: It is possible for the lead or anchor to be changed without a change to the selection. Notification of these changes is often important, such as when the new lead or anchor needs to be updated in the view. Therefore, caution is urged when changing the default value.

Returns:
the value of the leadAnchorNotificationEnabled flag
See Also:
setLeadAnchorNotificationEnabled(boolean) sample code for javax.swing.DefaultListSelectionModel.setLeadAnchorNotificationEnabled(boolean) definition code for javax.swing.DefaultListSelectionModel.setLeadAnchorNotificationEnabled(boolean)

clearSelection sample code for javax.swing.DefaultListSelectionModel.clearSelection() definition code for javax.swing.DefaultListSelectionModel.clearSelection()

public void clearSelection()
Description copied from interface: ListSelectionModel sample code for javax.swing.ListSelectionModel.clearSelection() definition code for javax.swing.ListSelectionModel.clearSelection()
Change the selection to the empty set. If this represents a change to the current selection then notify each ListSelectionListener.

Specified by:
clearSelection sample code for javax.swing.ListSelectionModel.clearSelection() definition code for javax.swing.ListSelectionModel.clearSelection() in interface ListSelectionModel sample code for javax.swing.ListSelectionModel definition code for javax.swing.ListSelectionModel
See Also:
ListSelectionModel.addListSelectionListener(javax.swing.event.ListSelectionListener) sample code for javax.swing.ListSelectionModel.addListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.ListSelectionModel.addListSelectionListener(javax.swing.event.ListSelectionListener)

setSelectionInterval sample code for javax.swing.DefaultListSelectionModel.setSelectionInterval(int, int) definition code for javax.swing.DefaultListSelectionModel.setSelectionInterval(int, int)

public void setSelectionInterval(int index0,
                                 int index1)
Description copied from interface: ListSelectionModel sample code for javax.swing.ListSelectionModel.setSelectionInterval(int, int) definition code for javax.swing.ListSelectionModel.setSelectionInterval(int, int)
Change the selection to be between index0 and index1 inclusive. If this represents a change to the current selection, then notify each ListSelectionListener. Note that index0 doesn't have to be less than or equal to index1.

Specified by:
setSelectionInterval sample code for javax.swing.ListSelectionModel.setSelectionInterval(int, int) definition code for javax.swing.ListSelectionModel.setSelectionInterval(int, int) in interface ListSelectionModel sample code for javax.swing.ListSelectionModel definition code for javax.swing.ListSelectionModel
Parameters:
index0 - one end of the interval.
index1 - other end of the interval
See Also:
ListSelectionModel.addListSelectionListener(javax.swing.event.ListSelectionListener) sample code for javax.swing.ListSelectionModel.addListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.ListSelectionModel.addListSelectionListener(javax.swing.event.ListSelectionListener)

addSelectionInterval sample code for javax.swing.DefaultListSelectionModel.addSelectionInterval(int, int) definition code for javax.swing.DefaultListSelectionModel.addSelectionInterval(int, int)

public void addSelectionInterval(int index0,
                                 int index1)
Description copied from interface: ListSelectionModel sample code for javax.swing.ListSelectionModel.addSelectionInterval(int, int) definition code for javax.swing.ListSelectionModel.addSelectionInterval(int, int)
Change the selection to be the set union of the current selection and the indices between index0 and index1 inclusive. If this represents a change to the current selection, then notify each ListSelectionListener. Note that index0 doesn't have to be less than or equal to index1.

Specified by:
addSelectionInterval sample code for javax.swing.ListSelectionModel.addSelectionInterval(int, int) definition code for javax.swing.ListSelectionModel.addSelectionInterval(int, int) in interface ListSelectionModel sample code for javax.swing.ListSelectionModel definition code for javax.swing.ListSelectionModel
Parameters:
index0 - one end of the interval.
index1 - other end of the interval
See Also:
ListSelectionModel.addListSelectionListener(javax.swing.event.ListSelectionListener) sample code for javax.swing.ListSelectionModel.addListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.ListSelectionModel.addListSelectionListener(javax.swing.event.ListSelectionListener)

removeSelectionInterval sample code for javax.swing.DefaultListSelectionModel.removeSelectionInterval(int, int) definition code for javax.swing.DefaultListSelectionModel.removeSelectionInterval(int, int)

public void removeSelectionInterval(int index0,
                                    int index1)
Description copied from interface: ListSelectionModel sample code for javax.swing.ListSelectionModel.removeSelectionInterval(int, int) definition code for javax.swing.ListSelectionModel.removeSelectionInterval(int, int)
Change the selection to be the set difference of the current selection and the indices between index0 and index1 inclusive. If this represents a change to the current selection, then notify each ListSelectionListener. Note that index0 doesn't have to be less than or equal to index1.

Specified by:
removeSelectionInterval sample code for javax.swing.ListSelectionModel.removeSelectionInterval(int, int) definition code for javax.swing.ListSelectionModel.removeSelectionInterval(int, int) in interface ListSelectionModel sample code for javax.swing.ListSelectionModel definition code for javax.swing.ListSelectionModel
Parameters:
index0 - one end of the interval.
index1 - other end of the interval
See Also:
ListSelectionModel.addListSelectionListener(javax.swing.event.ListSelectionListener) sample code for javax.swing.ListSelectionModel.addListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.ListSelectionModel.addListSelectionListener(javax.swing.event.ListSelectionListener)

insertIndexInterval sample code for javax.swing.DefaultListSelectionModel.insertIndexInterval(int, int, boolean) definition code for javax.swing.DefaultListSelectionModel.insertIndexInterval(int, int, boolean)

public void insertIndexInterval(int index,
                                int length,
                                boolean before)
Insert length indices beginning before/after index. If the value at index is itself selected and the selection mode is not SINGLE_SELECTION, set all of the newly inserted items as selected. Otherwise leave them unselected. This method is typically called to sync the selection model with a corresponding change in the data model.

Specified by:
insertIndexInterval sample code for javax.swing.ListSelectionModel.insertIndexInterval(int, int, boolean) definition code for javax.swing.ListSelectionModel.insertIndexInterval(int, int, boolean) in interface ListSelectionModel sample code for javax.swing.ListSelectionModel definition code for javax.swing.ListSelectionModel

removeIndexInterval sample code for javax.swing.DefaultListSelectionModel.removeIndexInterval(int, int) definition code for javax.swing.DefaultListSelectionModel.removeIndexInterval(int, int)

public void removeIndexInterval(int index0,
                                int index1)
Remove the indices in the interval index0,index1 (inclusive) from the selection model. This is typically called to sync the selection model width a corresponding change in the data model. Note that (as always) index0 need not be <= index1.

Specified by:
removeIndexInterval sample code for javax.swing.ListSelectionModel.removeIndexInterval(int, int) definition code for javax.swing.ListSelectionModel.removeIndexInterval(int, int) in interface ListSelectionModel sample code for javax.swing.ListSelectionModel definition code for javax.swing.ListSelectionModel

setValueIsAdjusting sample code for javax.swing.DefaultListSelectionModel.setValueIsAdjusting(boolean) definition code for javax.swing.DefaultListSelectionModel.setValueIsAdjusting(boolean)

public void setValueIsAdjusting(boolean isAdjusting)
Description copied from interface: ListSelectionModel sample code for javax.swing.ListSelectionModel.setValueIsAdjusting(boolean) definition code for javax.swing.ListSelectionModel.setValueIsAdjusting(boolean)
This property is true if upcoming changes to the value of the model should be considered a single event. For example if the model is being updated in response to a user drag, the value of the valueIsAdjusting property will be set to true when the drag is initiated and be set to false when the drag is finished. This property allows listeners to to update only when a change has been finalized, rather than always handling all of the intermediate values.

Specified by:
setValueIsAdjusting sample code for javax.swing.ListSelectionModel.setValueIsAdjusting(boolean) definition code for javax.swing.ListSelectionModel.setValueIsAdjusting(boolean) in interface ListSelectionModel sample code for javax.swing.ListSelectionModel definition code for javax.swing.ListSelectionModel
Parameters:
isAdjusting - The new value of the property.
See Also:
ListSelectionModel.getValueIsAdjusting() sample code for javax.swing.ListSelectionModel.getValueIsAdjusting() definition code for javax.swing.ListSelectionModel.getValueIsAdjusting()

toString sample code for javax.swing.DefaultListSelectionModel.toString() definition code for javax.swing.DefaultListSelectionModel.toString()

public String sample code for java.lang.String definition code for java.lang.String  toString()
Returns a string that displays and identifies this object's properties.

Overrides:
toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
a String representation of this object

clone sample code for javax.swing.DefaultListSelectionModel.clone() definition code for javax.swing.DefaultListSelectionModel.clone()

public Object sample code for java.lang.Object definition code for java.lang.Object  clone()
             throws CloneNotSupportedException sample code for java.lang.CloneNotSupportedException definition code for java.lang.CloneNotSupportedException 
Returns a clone of this selection model with the same selection. listenerLists are not duplicated.

Overrides:
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
a clone of this instance.
Throws:
CloneNotSupportedException sample code for java.lang.CloneNotSupportedException definition code for java.lang.CloneNotSupportedException - if the selection model does not both (a) implement the Cloneable interface and (b) define a clone method.
See Also:
Cloneable sample code for java.lang.Cloneable definition code for java.lang.Cloneable

getAnchorSelectionIndex sample code for javax.swing.DefaultListSelectionModel.getAnchorSelectionIndex() definition code for javax.swing.DefaultListSelectionModel.getAnchorSelectionIndex()

public int getAnchorSelectionIndex()
Description copied from interface: ListSelectionModel sample code for javax.swing.ListSelectionModel.getAnchorSelectionIndex() definition code for javax.swing.ListSelectionModel.getAnchorSelectionIndex()
Return the first index argument from the most recent call to setSelectionInterval(), addSelectionInterval() or removeSelectionInterval(). The most recent index0 is considered the "anchor" and the most recent index1 is considered the "lead". Some interfaces display these indices specially, e.g. Windows95 displays the lead index with a dotted yellow outline.

Specified by:
getAnchorSelectionIndex sample code for javax.swing.ListSelectionModel.getAnchorSelectionIndex() definition code for javax.swing.ListSelectionModel.getAnchorSelectionIndex() in interface ListSelectionModel sample code for javax.swing.ListSelectionModel definition code for javax.swing.ListSelectionModel
See Also:
ListSelectionModel.getLeadSelectionIndex() sample code for javax.swing.ListSelectionModel.getLeadSelectionIndex() definition code for javax.swing.ListSelectionModel.getLeadSelectionIndex() , ListSelectionModel.setSelectionInterval(int, int) sample code for javax.swing.ListSelectionModel.setSelectionInterval(int, int) definition code for javax.swing.ListSelectionModel.setSelectionInterval(int, int) , ListSelectionModel.addSelectionInterval(int, int) sample code for javax.swing.ListSelectionModel.addSelectionInterval(int, int) definition code for javax.swing.ListSelectionModel.addSelectionInterval(int, int)

getLeadSelectionIndex sample code for javax.swing.DefaultListSelectionModel.getLeadSelectionIndex() definition code for javax.swing.DefaultListSelectionModel.getLeadSelectionIndex()

public int getLeadSelectionIndex()
Description copied from interface: ListSelectionModel sample code for javax.swing.ListSelectionModel.getLeadSelectionIndex() definition code for javax.swing.ListSelectionModel.getLeadSelectionIndex()
Return the second index argument from the most recent call to setSelectionInterval(), addSelectionInterval() or removeSelectionInterval().

Specified by:
getLeadSelectionIndex sample code for javax.swing.ListSelectionModel.getLeadSelectionIndex() definition code for javax.swing.ListSelectionModel.getLeadSelectionIndex() in interface ListSelectionModel sample code for javax.swing.ListSelectionModel definition code for javax.swing.ListSelectionModel
See Also:
ListSelectionModel.getAnchorSelectionIndex() sample code for javax.swing.ListSelectionModel.getAnchorSelectionIndex() definition code for javax.swing.ListSelectionModel.getAnchorSelectionIndex() , ListSelectionModel.setSelectionInterval(int, int) sample code for javax.swing.ListSelectionModel.setSelectionInterval(int, int) definition code for javax.swing.ListSelectionModel.setSelectionInterval(int, int) , ListSelectionModel.addSelectionInterval(int, int) sample code for javax.swing.ListSelectionModel.addSelectionInterval(int, int) definition code for javax.swing.ListSelectionModel.addSelectionInterval(int, int)

setAnchorSelectionIndex sample code for javax.swing.DefaultListSelectionModel.setAnchorSelectionIndex(int) definition code for javax.swing.DefaultListSelectionModel.setAnchorSelectionIndex(int)

public void setAnchorSelectionIndex(int anchorIndex)
Set the anchor selection index, leaving all selection values unchanged. If leadAnchorNotificationEnabled is true, send a notification covering the old and new anchor cells.

Specified by:
setAnchorSelectionIndex sample code for javax.swing.ListSelectionModel.setAnchorSelectionIndex(int) definition code for javax.swing.ListSelectionModel.setAnchorSelectionIndex(int) in interface ListSelectionModel sample code for javax.swing.ListSelectionModel definition code for javax.swing.ListSelectionModel
See Also:
getAnchorSelectionIndex() sample code for javax.swing.DefaultListSelectionModel.getAnchorSelectionIndex() definition code for javax.swing.DefaultListSelectionModel.getAnchorSelectionIndex() , setLeadSelectionIndex(int) sample code for javax.swing.DefaultListSelectionModel.setLeadSelectionIndex(int) definition code for javax.swing.DefaultListSelectionModel.setLeadSelectionIndex(int)

moveLeadSelectionIndex sample code for javax.swing.DefaultListSelectionModel.moveLeadSelectionIndex(int) definition code for javax.swing.DefaultListSelectionModel.moveLeadSelectionIndex(int)

public void moveLeadSelectionIndex(int leadIndex)
Set the lead selection index, leaving all selection values unchanged. If leadAnchorNotificationEnabled is true, send a notification covering the old and new lead cells.

Parameters:
leadIndex - the new lead selection index
Since:
1.5
See Also:
setAnchorSelectionIndex(int) sample code for javax.swing.DefaultListSelectionModel.setAnchorSelectionIndex(int) definition code for javax.swing.DefaultListSelectionModel.setAnchorSelectionIndex(int) , setLeadSelectionIndex(int) sample code for javax.swing.DefaultListSelectionModel.setLeadSelectionIndex(int) definition code for javax.swing.DefaultListSelectionModel.setLeadSelectionIndex(int) , getLeadSelectionIndex() sample code for javax.swing.DefaultListSelectionModel.getLeadSelectionIndex() definition code for javax.swing.DefaultListSelectionModel.getLeadSelectionIndex()

setLeadSelectionIndex sample code for javax.swing.DefaultListSelectionModel.setLeadSelectionIndex(int) definition code for javax.swing.DefaultListSelectionModel.setLeadSelectionIndex(int)

public void setLeadSelectionIndex(int leadIndex)
Sets the lead selection index, ensuring that values between the anchor and the new lead are either all selected or all deselected. If the value at the anchor index is selected, first clear all the values in the range [anchor, oldLeadIndex], then select all the values values in the range [anchor, newLeadIndex], where oldLeadIndex is the old leadIndex and newLeadIndex is the new one.

If the value at the anchor index is not selected, do the same thing in reverse selecting values in the old range and deslecting values in the new one.

Generate a single event for this change and notify all listeners. For the purposes of generating minimal bounds in this event, do the operation in a single pass; that way the first and last index inside the ListSelectionEvent that is broadcast will refer to cells that actually changed value because of this method. If, instead, this operation were done in two steps the effect on the selection state would be the same but two events would be generated and the bounds around the changed values would be wider, including cells that had been first cleared only to later be set.

This method can be used in the mouseDragged method of a UI class to extend a selection.

Specified by:
setLeadSelectionIndex sample code for javax.swing.ListSelectionModel.setLeadSelectionIndex(int) definition code for javax.swing.ListSelectionModel.setLeadSelectionIndex(int) in interface ListSelectionModel sample code for javax.swing.ListSelectionModel definition code for javax.swing.ListSelectionModel
See Also:
getLeadSelectionIndex() sample code for javax.swing.DefaultListSelectionModel.getLeadSelectionIndex() definition code for javax.swing.DefaultListSelectionModel.getLeadSelectionIndex() , setAnchorSelectionIndex(int) sample code for javax.swing.DefaultListSelectionModel.setAnchorSelectionIndex(int) definition code for javax.swing.DefaultListSelectionModel.setAnchorSelectionIndex(int)