Java Reference
In-Depth Information
public interface ListSelectionModel {
// Constants
public final static int MULTIPLE_INTERVAL_SELECTION;
public final static int SINGLE_INTERVAL_SELECTION;
public final static int SINGLE_SELECTION;
// Properties
public int getAnchorSelectionIndex();
public void setAnchorSelectionIndex(int index);
public int getLeadSelectionIndex();
public void setLeadSelectionIndex(int index);
public int getMaxSelectionIndex();
public int getMinSelectionIndex();
public boolean isSelectionEmpty();
public int getSelectionMode();
public void setSelectionMode(int selectionMode);
public boolean getValueIsAdjusting();
public void setValueIsAdjusting(boolean valueIsAdjusting);
// Listeners
public void addListSelectionListener(ListSelectionListener x);
public void removeListSelectionListener(ListSelectionListener x);
// Other methods
public void addSelectionInterval(int index0, int index1);
public void clearSelection();
public void insertIndexInterval(int index, int length, boolean before);
public boolean isSelectedIndex(int index);
public void removeIndexInterval(int index0, int index1);
public void removeSelectionInterval(int index0, int index1);
public void setSelectionInterval(int index0, int index1);
}
Three different selection modes are available. Table 13-6 contains the name of each mode
and its description.
Table 13-6. ListSelectionModel Modes
Mode
Description
SINGLE_SELECTION
One item at a time can be selected.
SINGLE_INTERVAL_SELECTION
One contiguous range of items can be selected.
MULTIPLE_INTERVAL_SELECTION
Any set of ranges can be selected.
Figure 13-8 shows you the results of each selection mode.
Search WWH ::




Custom Search