com.zfqjava.swing
Class JListView
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--javax.swing.JComponent
|
+--com.zfqjava.swing.JListView
- All Implemented Interfaces:
- javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable
- public class JListView
- extends javax.swing.JComponent
- implements javax.accessibility.Accessible
JListView provides a component to diplay more objects
from a list.
Support sorting:
In order to support sorting, the TableModel used by
JListView should implements ColumnSorter
interface.
Client Property:
| Name | Value | Default Value |
| JListView.rowSelectionAllowed |
- Boolean.TRUE
- Boolean.FALSE
|
Boolean.FALSE |
| JListView.showVerticalLines |
- Boolean.TRUE
- Boolean.FALSE
|
Boolean.FALSE |
| JListView.showHorizontalLines |
- Boolean.TRUE
- Boolean.FALSE
|
Boolean.FALSE |
| JListView.backgroundImage |
|
null |
- See Also:
- Serialized Form
| Inner classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
| Inner classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent |
| Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
|
Constructor Summary |
JListView()
Constructs a JListView with an empty model. |
JListView(javax.swing.table.TableModel model)
Constructs a JListView with a table model. |
JListView(javax.swing.table.TableModel model,
int elementColumnIndex)
Constructs a JListView with a table model
and element column index. |
|
Method Summary |
void |
addActionListener(java.awt.event.ActionListener listener)
Adds an action listener to the JListView. |
void |
addListSelectionListener(javax.swing.event.ListSelectionListener listener)
Adds a listener to the list that's notified each time a change
to the selection occurs. |
void |
addSelectionInterval(int anchor,
int lead)
Sets the selection to be the union of the specified interval with current
selection. |
void |
cancelEditing()
Cancels the current editing. |
void |
clearSelection()
Clears the selection - after calling this method
isSelectionEmpty will return true. |
protected javax.swing.ListSelectionModel |
createSelectionModel()
Returns an instance of DefaultListSelectionModel. |
void |
fireActionPerformed(java.awt.event.ActionEvent e)
Notifies all listeners that have registered interest for
notification on this event type. |
protected void |
fireSelectionValueChanged(int firstIndex,
int lastIndex,
boolean isAdjusting)
Notifies JList ListSelectionListeners that
the selection model has changed. |
javax.accessibility.AccessibleContext |
getAccessibleContext()
Gets the AccessibleContext associated with this JListView. |
java.awt.event.ActionListener[] |
getActionListeners()
Returns an array of all the action listeners registered
on this JListView. |
int |
getAnchorSelectionIndex()
Returns the first index argument from the most recent
addSelectionModel or setSelectionInterval call. |
DefaultCellEditor |
getCellEditor()
Retruns the cell editor. |
DefaultCellRenderer |
getCellRenderer()
Retruns the cell renderer. |
int |
getEditingIndex()
Return the index of current editing. |
int |
getElementColumnIndex()
Returns the element column index. |
int |
getLeadSelectionIndex()
Returns the second index argument from the most recent
addSelectionInterval or setSelectionInterval
call. |
javax.swing.ListModel |
getListModel()
Returns the list view data model as ListModel. |
javax.swing.event.ListSelectionListener[] |
getListSelectionListeners()
Returns an array of all the ListSelectionListeners added
to this JList with addListSelectionListener(). |
int |
getMaxSelectionIndex()
Returns the largest selected cell index. |
int |
getMinSelectionIndex()
Returns the smallest selected cell index. |
int |
getSelectedIndex()
Returns the first selected index; returns -1 if there is no
selected item. |
int[] |
getSelectedIndices()
Returns an array of all of the selected indices in increasing
order. |
java.lang.Object |
getSelectedValue()
Returns the first selected value, or null if the
selection is empty. |
java.lang.Object[] |
getSelectedValues()
Returns an array of the values for the selected cells. |
int |
getSelectionMode()
Returns whether single-item or multiple-item selections are allowed. |
javax.swing.ListSelectionModel |
getSelectionModel()
Returns the value of the current selection model. |
javax.swing.table.TableModel |
getTableModel()
Returns the list view data model as TableModel. |
ListViewUI |
getUI()
Returns the look and feel (L&F) object that renders this component. |
java.lang.String |
getUIClassID()
Returns a string that specifies the name of the L&F class
that renders this component. |
boolean |
getValueIsAdjusting()
Returns the value of the data model's isAdjusting property. |
int |
getViewMode()
Gets the JListView display mode in use. |
boolean |
isEditing()
Returns true if the JListView is being edited. |
boolean |
isSelectedIndex(int index)
Returns true if the specified index is selected. |
boolean |
isSelectionEmpty()
Returns true if nothing is selected. |
protected java.lang.String |
paramString()
Returns a string representation of this JListView. |
void |
removeActionListener(java.awt.event.ActionListener listener)
Removes the specified action listener from the JListView. |
void |
removeListSelectionListener(javax.swing.event.ListSelectionListener listener)
Removes a listener from the list that's notified each time a
change to the selection occurs. |
void |
removeSelectionInterval(int index0,
int index1)
Sets the selection to be the set difference of the specified interval
and the current selection. |
void |
setCellEditor(DefaultCellEditor editor)
Sets the editor. |
void |
setCellRenderer(DefaultCellRenderer renderer)
Sets the renderer. |
void |
setListData(javax.swing.table.TableModel model)
Sets the list view data use the specified table model. |
void |
setListData(javax.swing.table.TableModel model,
int elementColumnIndex)
Sets the list view data use the specified table model and
the specified element column index. |
void |
setSelectedIndex(int index)
Selects a single cell. |
void |
setSelectedIndices(int[] indices)
Selects a set of cells. |
void |
setSelectionInterval(int anchor,
int lead)
Selects the specified interval. |
void |
setSelectionMode(int selectionMode)
Determines whether single-item or multiple-item
selections are allowed. |
void |
setSelectionModel(javax.swing.ListSelectionModel selectionModel)
Sets the current selection model. |
void |
setUI(ListViewUI ui)
Sets the look and feel (L&F) object that renders this component. |
void |
setValueIsAdjusting(boolean b)
Sets the data model's isAdjusting property to true,
so that a single event will be generated when all of the selection
events have finished (for example, when the mouse is being
dragged over the list in selection mode). |
void |
setViewMode(int mode)
Sets the JListView display mode. |
void |
startEditingAtIndex(int index)
Starts the editing at the specified index. |
boolean |
stopEditing()
Stops the current editing. |
void |
updateUI()
Resets the UI property with a value from the current look and feel. |
| Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
| Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree |
| Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
SMALL_ICON_VIEW_MODE
public static final int SMALL_ICON_VIEW_MODE
- Identifies the small icon view mode.
LARGE_ICON_VIEW_MODE
public static final int LARGE_ICON_VIEW_MODE
- Identifies the large icon view mode.
LIST_VIEW_MODE
public static final int LIST_VIEW_MODE
- Identifies the list view mode.
THUMBNAILS_VIEW_MODE
public static final int THUMBNAILS_VIEW_MODE
- Identifies the thumbnails view mode.
DETAILS_VIEW_MODE
public static final int DETAILS_VIEW_MODE
- Identifies the details view mode.
JListView
public JListView()
- Constructs a
JListView with an empty model.
JListView
public JListView(javax.swing.table.TableModel model)
- Constructs a
JListView with a table model.
- Parameters:
model - the table model
JListView
public JListView(javax.swing.table.TableModel model,
int elementColumnIndex)
- Constructs a
JListView with a table model
and element column index.
- Parameters:
model - the table modelelementColumnIndex - the element column index
updateUI
public void updateUI()
- Resets the UI property with a value from the current look and feel.
- Overrides:
updateUI in class javax.swing.JComponent
- See Also:
JComponent.updateUI()
getUI
public ListViewUI getUI()
- Returns the look and feel (L&F) object that renders this component.
- Returns:
- the ListViewUI object that renders this component
setUI
public void setUI(ListViewUI ui)
- Sets the look and feel (L&F) object that renders this component.
- Parameters:
ui - the ListViewUI L&F object- See Also:
UIDefaults.getUI(javax.swing.JComponent)
getUIClassID
public java.lang.String getUIClassID()
- Returns a string that specifies the name of the L&F class
that renders this component.
- Overrides:
getUIClassID in class javax.swing.JComponent
- Returns:
- "ListViewUI"
- See Also:
JComponent.getUIClassID(),
UIDefaults.getUI(javax.swing.JComponent)
createSelectionModel
protected javax.swing.ListSelectionModel createSelectionModel()
- Returns an instance of
DefaultListSelectionModel. This
method is used by the constructor to initialize the
selectionModel property.
- Returns:
- the
ListSelectionModel used by this
JListView. - See Also:
setSelectionModel(javax.swing.ListSelectionModel),
DefaultListSelectionModel
getSelectionModel
public javax.swing.ListSelectionModel getSelectionModel()
- Returns the value of the current selection model. The selection
model handles the task of making single selections, selections
of contiguous ranges, and non-contiguous selections.
- Returns:
- the
ListSelectionModel that implements
list selections - See Also:
setSelectionModel(javax.swing.ListSelectionModel),
ListSelectionModel
setSelectionModel
public void setSelectionModel(javax.swing.ListSelectionModel selectionModel)
- Sets the current selection model. The selection
model handles the task of making single selections, selections
of contiguous ranges, and non-contiguous selections.
- Parameters:
selectionModel - the ListSelectionModel
that implements list selections- See Also:
getSelectionModel()
setViewMode
public void setViewMode(int mode)
- Sets the
JListView display mode.
- Parameters:
mode - one of 5 legal values:
- JListView.SMALL_ICON_VIEW_MODE
- JListView.LARGE_ICON_VIEW_MODE
- JListView.LIST_VIEW_MODE
- JListView.DETAILS_VIEW_MODE
- JListView.THUMBNAILS_VIEW_MODE
- Throws:
java.lang.IllegalArgumentException - if the mode illegal
getViewMode
public int getViewMode()
- Gets the
JListView display mode in use.
- Returns:
- the display mode in use, one of 5 legal values:
- JListView.SMALL_ICON_VIEW_MODE
- JListView.LARGE_ICON_VIEW_MODE
- JListView.LIST_VIEW_MODE
- JListView.DETAILS_VIEW_MODE
- JListView.THUMBNAILS_VIEW_MODE
setCellRenderer
public void setCellRenderer(DefaultCellRenderer renderer)
- Sets the renderer.
- Parameters:
renderer - the cell renderer
getCellRenderer
public DefaultCellRenderer getCellRenderer()
- Retruns the cell renderer.
- Returns:
- the cell renderer
setCellEditor
public void setCellEditor(DefaultCellEditor editor)
- Sets the editor.
- Parameters:
editor - the cell editor
getCellEditor
public DefaultCellEditor getCellEditor()
- Retruns the cell editor.
- Returns:
- the cell editor
setListData
public void setListData(javax.swing.table.TableModel model)
- Sets the list view data use the specified table model.
The default element column index is 0.
- Parameters:
model - the list view data- See Also:
setListData(TableModel,int)
setListData
public void setListData(javax.swing.table.TableModel model,
int elementColumnIndex)
- Sets the list view data use the specified table model and
the specified element column index.
- Parameters:
model - the list view dataelementColumnIndex - the element column index- See Also:
setListData(TableModel)
getTableModel
public javax.swing.table.TableModel getTableModel()
- Returns the list view data model as
TableModel.
- Returns:
- the list view data model as
TableModel.
getListModel
public javax.swing.ListModel getListModel()
- Returns the list view data model as
ListModel.
This will auto create when setListData invoke.
- Returns:
- the list view data model as
ListModel.
getElementColumnIndex
public int getElementColumnIndex()
- Returns the element column index.
- Returns:
- the element column index
setSelectionMode
public void setSelectionMode(int selectionMode)
- Determines whether single-item or multiple-item
selections are allowed.
The following
selectionMode values are allowed:
-
ListSelectionModel.SINGLE_SELECTION
Only one list index can be selected at a time. In this
mode the setSelectionInterval and
addSelectionInterval
methods are equivalent, and only the second index
argument is used.
-
ListSelectionModel.SINGLE_INTERVAL_SELECTION
One contiguous index interval can be selected at a time.
In this mode setSelectionInterval and
addSelectionInterval
are equivalent.
-
ListSelectionModel.MULTIPLE_INTERVAL_SELECTION
In this mode, there's no restriction on what can be selected.
This is the default.
- Parameters:
selectionMode - an integer specifying the type of selections
that are permissible- See Also:
getSelectionMode()
getSelectionMode
public int getSelectionMode()
- Returns whether single-item or multiple-item selections are allowed.
- Returns:
- the value of the
selectionMode property - See Also:
setSelectionMode(int)
getAnchorSelectionIndex
public int getAnchorSelectionIndex()
- Returns the first index argument from the most recent
addSelectionModel or setSelectionInterval call.
This is a convenience method that just delegates to the
selectionModel.
- Returns:
- the index that most recently anchored an interval selection
- See Also:
ListSelectionModel.getAnchorSelectionIndex(),
addSelectionInterval(int, int),
setSelectionInterval(int, int),
addListSelectionListener(javax.swing.event.ListSelectionListener)
getLeadSelectionIndex
public int getLeadSelectionIndex()
- Returns the second index argument from the most recent
addSelectionInterval or setSelectionInterval
call.
This is a convenience method that just delegates to the
selectionModel.
- Returns:
- the index that most recently ended a interval selection
- See Also:
ListSelectionModel.getLeadSelectionIndex(),
addSelectionInterval(int, int),
setSelectionInterval(int, int),
addListSelectionListener(javax.swing.event.ListSelectionListener)
getMinSelectionIndex
public int getMinSelectionIndex()
- Returns the smallest selected cell index.
This is a convenience method that just delegates to the
selectionModel.
- Returns:
- the smallest selected cell index
- See Also:
ListSelectionModel.getMinSelectionIndex(),
addListSelectionListener(javax.swing.event.ListSelectionListener)
getMaxSelectionIndex
public int getMaxSelectionIndex()
- Returns the largest selected cell index.
This is a convenience method that just delegates to the
selectionModel.
- Returns:
- the largest selected cell index
- See Also:
ListSelectionModel.getMaxSelectionIndex(),
addListSelectionListener(javax.swing.event.ListSelectionListener)
isSelectedIndex
public boolean isSelectedIndex(int index)
- Returns true if the specified index is selected.
This is a convenience method that just delegates to the
selectionModel.
- Parameters:
index - index to be queried for selection state- Returns:
- true if the specified index is selected
- See Also:
ListSelectionModel.isSelectedIndex(int),
setSelectedIndex(int),
addListSelectionListener(javax.swing.event.ListSelectionListener)
isSelectionEmpty
public boolean isSelectionEmpty()
- Returns true if nothing is selected.
This is a convenience method that just delegates to the
selectionModel.
- Returns:
- true if nothing is selected
- See Also:
ListSelectionModel.isSelectionEmpty(),
clearSelection(),
addListSelectionListener(javax.swing.event.ListSelectionListener)
clearSelection
public void clearSelection()
- Clears the selection - after calling this method
isSelectionEmpty will return true.
This is a convenience method that just delegates to the
selectionModel.
- See Also:
ListSelectionModel.clearSelection(),
isSelectionEmpty(),
addListSelectionListener(javax.swing.event.ListSelectionListener)
setSelectionInterval
public void setSelectionInterval(int anchor,
int lead)
- Selects the specified interval. Both the
anchor
and lead indices are included. It's not
necessary for anchor to be less than lead.
This is a convenience method that just delegates to the
selectionModel.
The DefaultListSelectionModel implementation
will do nothing if either anchor or
lead are -1.
If anchor or lead are less than -1,
IndexOutOfBoundsException is thrown.
- Parameters:
anchor - the first index to selectlead - the last index to select- Throws:
java.lang.IndexOutOfBoundsException - if either anchor
or lead are less than -1- See Also:
ListSelectionModel.setSelectionInterval(int, int),
addSelectionInterval(int, int),
removeSelectionInterval(int, int),
addListSelectionListener(javax.swing.event.ListSelectionListener)
addSelectionInterval
public void addSelectionInterval(int anchor,
int lead)
- Sets the selection to be the union of the specified interval with current
selection. Both the anchor and lead indices are
included. It's not necessary for anchor to be less than lead.
This is a convenience method that just delegates to the
selectionModel. The
DefaultListSelectionModel implementation
will do nothing if either anchor or
lead are -1.
If anchor or lead are less than -1,
IndexOutOfBoundsException is thrown.
- Parameters:
anchor - the first index to add to the selectionlead - the last index to add to the selection- Throws:
java.lang.IndexOutOfBoundsException - if either anchor
or lead are less than -1- See Also:
ListSelectionModel.addSelectionInterval(int, int),
setSelectionInterval(int, int),
removeSelectionInterval(int, int),
addListSelectionListener(javax.swing.event.ListSelectionListener)
removeSelectionInterval
public void removeSelectionInterval(int index0,
int index1)
- Sets the selection to be the set difference of the specified interval
and the current selection. Both the
index0 and
index1 indices are removed. It's not necessary for
index0 to be less than index1.
This is a convenience method that just delegates to the
selectionModel.
The DefaultListSelectionModel implementation
will do nothing if either index0 or
index1 are -1.
If index0 or index1 are less than -1,
IndexOutOfBoundsException is thrown.
- Parameters:
index0 - the first index to remove from the selectionindex1 - the last index to remove from the selection- Throws:
java.lang.IndexOutOfBoundsException - if either index0
or index1 are less than -1- See Also:
ListSelectionModel.removeSelectionInterval(int, int),
setSelectionInterval(int, int),
addSelectionInterval(int, int),
addListSelectionListener(javax.swing.event.ListSelectionListener)
setValueIsAdjusting
public void setValueIsAdjusting(boolean b)
- Sets the data model's
isAdjusting property to true,
so that a single event will be generated when all of the selection
events have finished (for example, when the mouse is being
dragged over the list in selection mode).
- Parameters:
b - the boolean value for the property value- See Also:
ListSelectionModel.setValueIsAdjusting(boolean)
getValueIsAdjusting
public boolean getValueIsAdjusting()
- Returns the value of the data model's
isAdjusting property.
This value is true if multiple changes are being made.
- Returns:
- true if multiple selection-changes are occurring, as
when the mouse is being dragged over the list
- See Also:
ListSelectionModel.getValueIsAdjusting()
setSelectedIndex
public void setSelectedIndex(int index)
- Selects a single cell.
- Parameters:
index - the index of the one cell to select- See Also:
ListSelectionModel.setSelectionInterval(int, int),
isSelectedIndex(int),
addListSelectionListener(javax.swing.event.ListSelectionListener)
getSelectedIndex
public int getSelectedIndex()
- Returns the first selected index; returns -1 if there is no
selected item.
- Returns:
- the value of
getMinSelectionIndex - See Also:
getMinSelectionIndex(),
addListSelectionListener(javax.swing.event.ListSelectionListener)
setSelectedIndices
public void setSelectedIndices(int[] indices)
- Selects a set of cells.
- Parameters:
indices - an array of the indices of the cells to select- See Also:
ListSelectionModel.addSelectionInterval(int, int),
isSelectedIndex(int),
addListSelectionListener(javax.swing.event.ListSelectionListener)
getSelectedIndices
public int[] getSelectedIndices()
- Returns an array of all of the selected indices in increasing
order.
- Returns:
- all of the selected indices, in increasing order
- See Also:
removeSelectionInterval(int, int),
addListSelectionListener(javax.swing.event.ListSelectionListener)
getSelectedValues
public java.lang.Object[] getSelectedValues()
- Returns an array of the values for the selected cells.
The returned values are sorted in increasing index order.
- Returns:
- the selected values or an empty list if
nothing is selected
- See Also:
isSelectedIndex(int),
getListModel(),
addListSelectionListener(javax.swing.event.ListSelectionListener)
getSelectedValue
public java.lang.Object getSelectedValue()
- Returns the first selected value, or
null if the
selection is empty.
- Returns:
- the first selected value
- See Also:
getMinSelectionIndex(),
getListModel(),
addListSelectionListener(javax.swing.event.ListSelectionListener)
isEditing
public boolean isEditing()
- Returns true if the
JListView is being edited.
- Returns:
- true if the
JListView is being edited,
otherwise return false
stopEditing
public boolean stopEditing()
- Stops the current editing.
- Returns:
- true if the editing is stoped, otherwise return false
cancelEditing
public void cancelEditing()
- Cancels the current editing.
startEditingAtIndex
public void startEditingAtIndex(int index)
- Starts the editing at the specified index.
- Parameters:
index - the specified index
getEditingIndex
public int getEditingIndex()
- Return the index of current editing.
- Returns:
- the index of current editing
addActionListener
public void addActionListener(java.awt.event.ActionListener listener)
- Adds an action listener to the
JListView.
- Parameters:
listener - the listener to add- See Also:
JListView()
removeActionListener
public void removeActionListener(java.awt.event.ActionListener listener)
- Removes the specified action listener from the
JListView.
- Parameters:
listener - the listener to remove
getActionListeners
public java.awt.event.ActionListener[] getActionListeners()
- Returns an array of all the action listeners registered
on this JListView.
- Returns:
- all of the JListView's
ActionListeners or an empty
array if no action listeners are currently registered - See Also:
addActionListener(java.awt.event.ActionListener),
removeActionListener(java.awt.event.ActionListener)
fireActionPerformed
public void fireActionPerformed(java.awt.event.ActionEvent e)
- Notifies all listeners that have registered interest for
notification on this event type.
- Parameters:
e - the action event to fire- See Also:
EventListenerList
addListSelectionListener
public void addListSelectionListener(javax.swing.event.ListSelectionListener listener)
- Adds a listener to the list that's notified each time a change
to the selection occurs. Listeners added directly to the
JListView
will have their ListSelectionEvent.getSource() ==
this JListView
(instead of the ListSelectionModel).
- Parameters:
listener - the ListSelectionListener to add- See Also:
getSelectionModel(),
getListSelectionListeners()
removeListSelectionListener
public void removeListSelectionListener(javax.swing.event.ListSelectionListener listener)
- Removes a listener from the list that's notified each time a
change to the selection occurs.
- Parameters:
listener - the ListSelectionListener to remove- See Also:
addListSelectionListener(javax.swing.event.ListSelectionListener),
getSelectionModel()
getListSelectionListeners
public javax.swing.event.ListSelectionListener[] getListSelectionListeners()
- Returns an array of all the
ListSelectionListeners added
to this JList with addListSelectionListener().
- Returns:
- all of the
ListSelectionListeners added or an empty
array if no listeners have been added - See Also:
addListSelectionListener(javax.swing.event.ListSelectionListener)
fireSelectionValueChanged
protected void fireSelectionValueChanged(int firstIndex,
int lastIndex,
boolean isAdjusting)
- Notifies
JList ListSelectionListeners that
the selection model has changed. It's used to forward
ListSelectionEvents from the selectionModel
to the ListSelectionListeners added directly to the
JList.
- Parameters:
firstIndex - the first selected indexlastIndex - the last selected indexisAdjusting - true if multiple changes are being made- See Also:
addListSelectionListener(javax.swing.event.ListSelectionListener),
removeListSelectionListener(javax.swing.event.ListSelectionListener),
EventListenerList
paramString
protected java.lang.String paramString()
- Returns a string representation of this JListView. This method
is intended to be used only for debugging purposes, and the
content and format of the returned string may vary between
implementations. The returned string may be empty but may not
be
null.
- Overrides:
paramString in class javax.swing.JComponent
- Returns:
- a string representation of this JListView.
getAccessibleContext
public javax.accessibility.AccessibleContext getAccessibleContext()
- Gets the AccessibleContext associated with this JListView.
For JListViews, the AccessibleContext takes the form of an
AccessibleJListView.
A new AccessibleJListView instance is created if necessary.
- Specified by:
getAccessibleContext in interface javax.accessibility.Accessible- Overrides:
getAccessibleContext in class javax.swing.JComponent
- Returns:
- an AccessibleJListView that serves as the
AccessibleContext of this JListView
Copyright © 2001-2003 Extreme Component, Inc. All rights reserved.