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 java.
.
ListSelectionModel
Modifier and Type | Field and Description |
---|---|
private int | |
private int | |
private int | |
private boolean | |
private int | |
private int | |
protected boolean | leadAnchorNotificationEnabled
Whether or not the lead anchor notification is enabled. |
private int | |
protected EventListenerList | listenerList
The list of listeners. |
private static final int | |
private int | |
private static final int | |
private int | |
private int | |
private BitSet |
Access | Constructor and Description |
---|---|
public |
Modifier and Type | Method and Description |
---|---|
public void | addListSelectionListener(ListSelectionListener
the ListSelectionListener l)Implements javax. |
public void | addSelectionInterval(int
one end of the interval. index0, int other end of the interval index1)Implements javax. index0 and index1 inclusive.
|
private void | |
private void | changeSelection(int clearMin, int clearMax, int setMin, int setMax)
Change the selection with the effect of first clearing the values in the inclusive range [clearMin, clearMax] then setting the values in the inclusive range [setMin, setMax]. |
private void | |
public void | clearSelection()
Implements javax. |
public Object | clone()
Overrides java. |
private boolean | |
protected void | fireValueChanged(boolean
true if this is the final change in a series of
adjustments isAdjusting)Notifies listeners that we have ended a series of adjustments. |
protected void | fireValueChanged(int
the first index in the interval firstIndex, int the last index in the interval lastIndex)Notifies |
protected void | fireValueChanged(int
the first index in the interval firstIndex, int the last index in the interval lastIndex, boolean true if this is the final change in a series of
adjustments isAdjusting)Notifies |
private void | |
public int | getAnchorSelectionIndex()
Implements javax. |
public int | getLeadSelectionIndex()
Implements javax. |
public < the type of T extends EventListener> T[]EventListener class being requested | Returns: an array of all objects registered asFooListener s
on this model,
or an empty array if no such
listeners have been addedthe type of listeners requested;
this parameter should specify an interface
that descends from listenerType)java.util.EventListener Returns an array of all the objects currently registered as
|
public ListSelectionListener[] | Returns: all of this model'sListSelectionListener s
or an empty
array if no list selection listeners are currently registeredReturns an array of all the list selection listeners
registered on this |
public int | getMaxSelectionIndex()
Implements javax. |
public int | getMinSelectionIndex()
Implements javax. |
public int | getSelectionMode()
Implements javax. |
public boolean | getValueIsAdjusting()
Implements javax. true if the selection is undergoing a series of changes.
|
public void | insertIndexInterval(int
the beginning of the interval index, int the length of the interval length, boolean if before)true , interval inserts before the index ,
otherwise, interval inserts after the index Implements javax. |
public boolean | Returns: the value of theleadAnchorNotificationEnabled flagReturns the value of the |
public boolean | isSelectedIndex(int
an index index)Implements javax. |
public boolean | isSelectionEmpty()
Implements javax. |
private void | |
public void | moveLeadSelectionIndex(int
the new lead selection index leadIndex)Set the lead selection index, leaving all selection values unchanged. |
public void | removeIndexInterval(int
the beginning of the interval index0, int the end of the interval index1)Implements javax. |
public void | removeListSelectionListener(ListSelectionListener
the ListSelectionListener l)Implements javax. |
public void | removeSelectionInterval(int
one end of the interval index0, int other end of the interval index1)Implements javax. index0 and index1 inclusive.
|
private void | |
private void | |
public void | setAnchorSelectionIndex(int
the anchor selection index anchorIndex)Implements javax. |
public void | setLeadAnchorNotificationEnabled(boolean
boolean value for flag)leadAnchorNotificationEnabled Sets the value of the leadAnchorNotificationEnabled flag. |
public void | setLeadSelectionIndex(int
the lead selection index leadIndex)Implements javax. |
public void | setSelectionInterval(int
one end of the interval. index0, int other end of the interval index1)Implements javax. index0 and index1
inclusive.
|
public void | setSelectionMode(int
the selection mode selectionMode)Implements javax. |
private void | |
public void | setValueIsAdjusting(boolean
the new value of the property isAdjusting)Implements javax. valueIsAdjusting property, which indicates whether
or not upcoming selection changes should be considered part of a single
change.
|
public String | Returns: aString representation of this objectOverrides java. |
private void |
anchorIndex | back to summary |
---|---|
private int anchorIndex |
firstAdjustedIndex | back to summary |
---|---|
private int firstAdjustedIndex |
firstChangedIndex | back to summary |
---|---|
private int firstChangedIndex |
isAdjusting | back to summary |
---|---|
private boolean isAdjusting |
lastAdjustedIndex | back to summary |
---|---|
private int lastAdjustedIndex |
lastChangedIndex | back to summary |
---|---|
private int lastChangedIndex |
leadAnchorNotificationEnabled | back to summary |
---|---|
protected boolean leadAnchorNotificationEnabled Whether or not the lead anchor notification is enabled. |
leadIndex | back to summary |
---|---|
private int leadIndex |
listenerList | back to summary |
---|---|
protected EventListenerList listenerList The list of listeners. |
MAX | back to summary |
---|---|
private static final int MAX |
maxIndex | back to summary |
---|---|
private int maxIndex |
MIN | back to summary |
---|---|
private static final int MIN |
minIndex | back to summary |
---|---|
private int minIndex |
selectionMode | back to summary |
---|---|
private int selectionMode |
value | back to summary |
---|---|
private BitSet value |
DefaultListSelectionModel | back to summary |
---|---|
public DefaultListSelectionModel() Constructs a |
addListSelectionListener | back to summary |
---|---|
public void addListSelectionListener(ListSelectionListener l) Implements javax. Doc from javax. Add a listener to the list that's notified each time a change to the selection occurs.
|
addSelectionInterval | back to summary |
---|---|
public void addSelectionInterval(int index0, int index1) Implements javax. Changes the selection to be the set union of the current selection
and the indices between
In
If this represents a change to the current selection, then each
If either index is
|
changeSelection | back to summary |
---|---|
private void changeSelection(int clearMin, int clearMax, int setMin, int setMax, boolean clearFirst) |
changeSelection | back to summary |
---|---|
private void changeSelection(int clearMin, int clearMax, int setMin, int setMax) Change the selection with the effect of first clearing the values in the inclusive range [clearMin, clearMax] then setting the values in the inclusive range [setMin, setMax]. Do this in one pass so that no values are cleared if they would later be set. |
clear | back to summary |
---|---|
private void clear(int r) |
clearSelection | back to summary |
---|---|
public void clearSelection() Implements javax. Doc from javax. Change the selection to the empty set. If this represents a change to the current selection then notify each ListSelectionListener. |
clone | back to summary |
---|---|
public Object clone() throws CloneNotSupportedException Overrides java. Returns a clone of this selection model with the same selection.
|
contains | back to summary |
---|---|
private boolean contains(int a, int b, int i) |
fireValueChanged | back to summary |
---|---|
protected void fireValueChanged(boolean isAdjusting) Notifies listeners that we have ended a series of adjustments.
|
fireValueChanged | back to summary |
---|---|
protected void fireValueChanged(int firstIndex, int lastIndex) Notifies
|
fireValueChanged | back to summary |
---|---|
protected void fireValueChanged(int firstIndex, int lastIndex, boolean isAdjusting) Notifies
|
fireValueChanged | back to summary |
---|---|
private void fireValueChanged() |
getAnchorSelectionIndex | back to summary |
---|---|
public int getAnchorSelectionIndex() Implements javax. Doc from javax. 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.
|
getLeadSelectionIndex | back to summary |
---|---|
public int getLeadSelectionIndex() Implements javax. Doc from javax. Return the second index argument from the most recent call to setSelectionInterval(), addSelectionInterval() or removeSelectionInterval().
|
getListeners | back to summary |
---|---|
public <T extends EventListener> T[] getListeners(Class<T> listenerType) Returns an array of all the objects currently registered as
You can specify the ListSelectionListener[] lsls = (ListSelectionListener[])(m.getListeners(ListSelectionListener.class));If no such listeners exist, this method returns an empty array.
|
getListSelectionListeners | back to summary |
---|---|
public ListSelectionListener[] getListSelectionListeners() Returns an array of all the list selection listeners
registered on this
|
getMaxSelectionIndex | back to summary |
---|---|
public int getMaxSelectionIndex() Implements javax. Doc from javax. Returns the last selected index or -1 if the selection is empty.
|
getMinSelectionIndex | back to summary |
---|---|
public int getMinSelectionIndex() Implements javax. Doc from javax. Returns the first selected index or -1 if the selection is empty.
|
getSelectionMode | back to summary |
---|---|
public int getSelectionMode() Implements javax. Doc from javax. Returns the current selection mode.
|
getValueIsAdjusting | back to summary |
---|---|
public boolean getValueIsAdjusting() Implements javax. Doc from javax. Returns
|
insertIndexInterval | back to summary |
---|---|
public void insertIndexInterval(int index, int length, boolean before) Implements javax. 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.
|
isLeadAnchorNotificationEnabled | back to summary |
---|---|
public boolean isLeadAnchorNotificationEnabled() Returns the value of the 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.
|
isSelectedIndex | back to summary |
---|---|
public boolean isSelectedIndex(int index) Implements javax. Doc from javax. Returns true if the specified index is selected.
|
isSelectionEmpty | back to summary |
---|---|
public boolean isSelectionEmpty() Implements javax. Doc from javax. Returns true if no indices are selected.
|
markAsDirty | back to summary |
---|---|
private void markAsDirty(int r) |
moveLeadSelectionIndex | back to summary |
---|---|
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.
|
removeIndexInterval | back to summary |
---|---|
public void removeIndexInterval(int index0, int index1) Implements javax. 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.
|
removeListSelectionListener | back to summary |
---|---|
public void removeListSelectionListener(ListSelectionListener l) Implements javax. Doc from javax. Remove a listener from the list that's notified each time a change to the selection occurs.
|
removeSelectionInterval | back to summary |
---|---|
public void removeSelectionInterval(int index0, int index1) Implements javax. Changes the selection to be the set difference of the current selection
and the indices between
In
If this represents a change to the current selection, then each
If either index is
|
removeSelectionIntervalImpl | back to summary |
---|---|
private void removeSelectionIntervalImpl(int index0, int index1, boolean changeLeadAnchor) |
set | back to summary |
---|---|
private void set(int r) |
setAnchorSelectionIndex | back to summary |
---|---|
public void setAnchorSelectionIndex(int anchorIndex) Implements javax. Set the anchor selection index, leaving all selection values unchanged. If leadAnchorNotificationEnabled is true, send a notification covering the old and new anchor cells.
|
setLeadAnchorNotificationEnabled | back to summary |
---|---|
public void setLeadAnchorNotificationEnabled(boolean flag) Sets the value of the leadAnchorNotificationEnabled flag.
|
setLeadSelectionIndex | back to summary |
---|---|
public void setLeadSelectionIndex(int leadIndex) Implements javax. 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 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 deselecting 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
|
setSelectionInterval | back to summary |
---|---|
public void setSelectionInterval(int index0, int index1) Implements javax. Changes the selection to be between
In
If this represents a change to the current selection, then each
If either index is
|
setSelectionMode | back to summary |
---|---|
public void setSelectionMode(int selectionMode) Implements javax. Doc from javax. Sets the selection mode. The following list describes the accepted selection modes:
|
setState | back to summary |
---|---|
private void setState(int index, boolean state) |
setValueIsAdjusting | back to summary |
---|---|
public void setValueIsAdjusting(boolean isAdjusting) Implements javax. Doc from javax. Sets the
For example, if the selection is being updated in response to a user
drag, this property can be set to
Setting this property to
|
toString | back to summary |
---|---|
public String toString() Overrides java. Returns a string that displays and identifies this object's properties.
|
updateLeadAnchorIndices | back to summary |
---|---|
private void updateLeadAnchorIndices(int anchorIndex, int leadIndex) |