charvax.swing

Interface ListSelectionModel

Known Implementing Classes:
DefaultListSelectionModel

public interface ListSelectionModel

Field Summary

static int
MULTIPLE_INTERVAL_SELECTION
static int
SINGLE_INTERVAL_SELECTION
static int
SINGLE_SELECTION

Method Summary

void
addListSelectionListener(ListSelectionListener l)
Add a listener to the list that is notified each time the selection changes.
void
addSelectionInterval(int index0, int index1)
Change the selection to be the set union between the current selection and the indices between index0 and index1 inclusive.
void
clearSelection()
Change the selection to be the empty set.
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 current selection mode.
void
insertIndexInterval(int index, int length, boolean before)
Insert length indices beginning before/after index, without notifying the ListSelectionListeners.
boolean
isSelectedIndex(int index)
Returns true if the specified index is selected.
boolean
isSelectionEmpty()
Returns true if no indices are selected.
void
removeIndexInterval(int index0, int index1)
Remove the indices in the interval index0,index1 (inclusive) from the selection model, without notifying the ListSelectionListeners.
void
removeListSelectionListener(ListSelectionListener l)
Remove the specified listener from the list of listeners.
void
removeSelectionInterval(int index0, int index1)
Change the selection to be the set difference between the current selection and the indices between index0 and index1 inclusive.
void
setSelectionInterval(int index0, int index1)
Change the selection to be between index0 and index1 inclusive.
void
setSelectionMode(int mode_)
Set the selection mode.

Field Details

MULTIPLE_INTERVAL_SELECTION

public static final int MULTIPLE_INTERVAL_SELECTION
Field Value:
203

SINGLE_INTERVAL_SELECTION

public static final int SINGLE_INTERVAL_SELECTION
Field Value:
202

SINGLE_SELECTION

public static final int SINGLE_SELECTION
Field Value:
201

Method Details

addListSelectionListener

public void addListSelectionListener(ListSelectionListener l)
Add a listener to the list that is notified each time the selection changes.

addSelectionInterval

public void addSelectionInterval(int index0,
                                 int index1)
Change the selection to be the set union between 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 does not have to be less than or equal to index1.

clearSelection

public void clearSelection()
Change the selection to be the empty set. If this represents a change to the selection then notify each ListSelectionListener.

getMaxSelectionIndex

public int getMaxSelectionIndex()
Returns the last selected index, or -1 if the selection is empty.

getMinSelectionIndex

public int getMinSelectionIndex()
Returns the first selected index, or -1 if the selection is empty.

getSelectionMode

public int getSelectionMode()
Returns the current selection mode.

insertIndexInterval

public void insertIndexInterval(int index,
                                int length,
                                boolean before)
Insert length indices beginning before/after index, without notifying the ListSelectionListeners. This is typically called to sync the selection model with a corresponding change in the data model.

isSelectedIndex

public boolean isSelectedIndex(int index)
Returns true if the specified index is selected.

isSelectionEmpty

public boolean isSelectionEmpty()
Returns true if no indices are selected.

removeIndexInterval

public void removeIndexInterval(int index0,
                                int index1)
Remove the indices in the interval index0,index1 (inclusive) from the selection model, without notifying the ListSelectionListeners. This is typically called to sync the selection model width a corresponding change in the data model.

removeListSelectionListener

public void removeListSelectionListener(ListSelectionListener l)
Remove the specified listener from the list of listeners.

removeSelectionInterval

public void removeSelectionInterval(int index0,
                                    int index1)
Change the selection to be the set difference between 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 does not have to be less than or equal to index1.

setSelectionInterval

public void setSelectionInterval(int index0,
                                 int index1)
Change the selection to be between index0 and index1 inclusive. If this represents a change to the selection, then notify each ListSelectionListener. Note that index0 doesn't have to be less than or equal to index1.

setSelectionMode

public void setSelectionMode(int mode_)
Set the selection mode. The following modes are allowed:
  • SINGLE_SELECTION. Only one list index can be selected at a time.
  • SINGLE_INTERVAL_SELECTION. One contiguous index interval can be set at at time.