swingwtx.swing
Class DefaultListSelectionModel
java.lang.Object
swingwtx.swing.DefaultListSelectionModel
- All Implemented Interfaces:
- ListSelectionModel
- public class DefaultListSelectionModel
- extends java.lang.Object
- implements ListSelectionModel
Handles tying to components and how selections are
performed/reported.
Note: This class is very important for JTable/JList and if you
want to implement your own, you are better off extending this
class than starting with something that implements ListSelectionModel.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
component
protected JComponent component
- We hold a reference to the component we are being a selection
model for. This allows us to manipulate it's selection
much easier and retrieve info about the
selection from the component (and the component
can update us when the selection changes).
table
protected JTable table
list
protected JList list
isTable
protected boolean isTable
listeners
protected java.util.Vector listeners
index0
protected int index0
index1
protected int index1
mode
protected int mode
isAdjusting
protected boolean isAdjusting
DefaultListSelectionModel
public DefaultListSelectionModel()
DefaultListSelectionModel
protected DefaultListSelectionModel(JComponent component)
addListSelectionListener
public void addListSelectionListener(ListSelectionListener x)
- Specified by:
addListSelectionListener in interface ListSelectionModel
addSelectionInterval
public void addSelectionInterval(int index0,
int index1)
- Specified by:
addSelectionInterval in interface ListSelectionModel
clearSelection
public void clearSelection()
- Specified by:
clearSelection in interface ListSelectionModel
getAnchorSelectionIndex
public int getAnchorSelectionIndex()
- Specified by:
getAnchorSelectionIndex in interface ListSelectionModel
getLeadSelectionIndex
public int getLeadSelectionIndex()
- Specified by:
getLeadSelectionIndex in interface ListSelectionModel
getMaxSelectionIndex
public int getMaxSelectionIndex()
- Specified by:
getMaxSelectionIndex in interface ListSelectionModel
getMinSelectionIndex
public int getMinSelectionIndex()
- Specified by:
getMinSelectionIndex in interface ListSelectionModel
getSelectionMode
public int getSelectionMode()
- Specified by:
getSelectionMode in interface ListSelectionModel
getValueIsAdjusting
public boolean getValueIsAdjusting()
- Specified by:
getValueIsAdjusting in interface ListSelectionModel
insertIndexInterval
public void insertIndexInterval(int index,
int length,
boolean before)
- Specified by:
insertIndexInterval in interface ListSelectionModel
isSelectedIndex
public boolean isSelectedIndex(int index)
- Specified by:
isSelectedIndex in interface ListSelectionModel
isSelectionEmpty
public boolean isSelectionEmpty()
- Specified by:
isSelectionEmpty in interface ListSelectionModel
removeIndexInterval
public void removeIndexInterval(int index0,
int index1)
- Specified by:
removeIndexInterval in interface ListSelectionModel
removeListSelectionListener
public void removeListSelectionListener(ListSelectionListener x)
- Specified by:
removeListSelectionListener in interface ListSelectionModel
removeSelectionInterval
public void removeSelectionInterval(int index0,
int index1)
- Specified by:
removeSelectionInterval in interface ListSelectionModel
setAnchorSelectionIndex
public void setAnchorSelectionIndex(int index)
- Specified by:
setAnchorSelectionIndex in interface ListSelectionModel
setLeadSelectionIndex
public void setLeadSelectionIndex(int index)
- Specified by:
setLeadSelectionIndex in interface ListSelectionModel
setSelectionInterval
public void setSelectionInterval(int index0,
int index1)
- Specified by:
setSelectionInterval in interface ListSelectionModel
setSelectionMode
public void setSelectionMode(int selectionMode)
- Specified by:
setSelectionMode in interface ListSelectionModel
setValueIsAdjusting
public void setValueIsAdjusting(boolean valueIsAdjusting)
- Specified by:
setValueIsAdjusting in interface ListSelectionModel
updateComponentForSelection
protected void updateComponentForSelection()
- Sets the component to have the selection specified
in this model.