Module java.desktop
Package javax.swing

Class DefaultListSelectionModel

java.lang.Object
javax.swing.DefaultListSelectionModel
All Implemented Interfaces:
Serializable, Cloneable, ListSelectionModel

public class DefaultListSelectionModel extends Object implements ListSelectionModel, 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 JavaBeans has been added to the java.beans package. Please see XMLEncoder.

Since:
1.2
See Also:
ListSelectionModel
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
    Whether or not the lead anchor notification is enabled.
    The list of listeners.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a DefaultListSelectionModel.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Add a listener to the list that's notified each time a change to the selection occurs.
    void
    addSelectionInterval​(int index0, int index1)
    Changes the selection to be the set union of the current selection and the indices between index0 and index1 inclusive.
    void
    Change the selection to the empty set.
    Returns a clone of this selection model with the same selection.
    protected void
    fireValueChanged​(boolean isAdjusting)
    Notifies listeners that we have ended a series of adjustments.
    protected void
    fireValueChanged​(int firstIndex, int lastIndex)
    Notifies ListSelectionListeners that the value of the selection, in the closed interval firstIndex, lastIndex, has changed.
    protected void
    fireValueChanged​(int firstIndex, int lastIndex, boolean isAdjusting)
     
    int
    Return the first index argument from the most recent call to setSelectionInterval(), addSelectionInterval() or removeSelectionInterval().
    int
    Return the second index argument from the most recent call to setSelectionInterval(), addSelectionInterval() or removeSelectionInterval().
    <T extends EventListener>
    T[]
    getListeners​(Class<T> listenerType)
    Returns an array of all the objects currently registered as FooListeners upon this model.
    Returns an array of all the list selection listeners registered on this DefaultListSelectionModel.
    int
    Returns the last selected index or -1 if the selection is empty.
    int
    Returns the first selected index or -1 if the selection is empty.
    int
    Returns the current selection mode.
    boolean
    Returns true if the selection is undergoing a series of changes.
    void
    insertIndexInterval​(int index, int length, boolean before)
    Insert length indices beginning before/after index.
    boolean
    Returns the value of the leadAnchorNotificationEnabled flag.
    boolean
    isSelectedIndex​(int index)
    Returns true if the specified index is selected.
    boolean
    Returns true if no indices are selected.
    void
    moveLeadSelectionIndex​(int leadIndex)
    Set the lead selection index, leaving all selection values unchanged.
    void
    removeIndexInterval​(int index0, int index1)
    Remove the indices in the interval index0,index1 (inclusive) from the selection model.
    void
    Remove a listener from the list that's notified each time a change to the selection occurs.
    void
    removeSelectionInterval​(int index0, int index1)
    Changes the selection to be the set difference of the current selection and the indices between index0 and index1 inclusive.
    void
    setAnchorSelectionIndex​(int anchorIndex)
    Set the anchor selection index, leaving all selection values unchanged.
    void
    Sets the value of the leadAnchorNotificationEnabled flag.
    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.
    void
    setSelectionInterval​(int index0, int index1)
    Changes the selection to be between index0 and index1 inclusive.
    void
    setSelectionMode​(int selectionMode)
    Sets the selection mode.
    void
    setValueIsAdjusting​(boolean isAdjusting)
    Sets the valueIsAdjusting property, which indicates whether or not upcoming selection changes should be considered part of a single change.