Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

javax.swing
Class JList  view JList download JList.java

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JList
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, Scrollable, java.io.Serializable

public class JList
extends JComponent
implements javax.accessibility.Accessible, Scrollable

This class is a facade over three separate objects: ListModel, ListSelectionModel and javax.swing.plaf.ListUI. The facade represents a unified "list" concept, with independently replacable (possibly client-provided) models for its contents and its current selection. In addition, each element in the list is rendered via a strategy class ListCellRenderer.

Lists have many properties, some of which are stored in this class while others are delegated to the list's model or selection. The following properties are available:

Property Stored inBound?
accessibleContext list no
anchorSelectionIndex selectionno
cellRenderer list yes
dragEnabled list no
firstVisibleIndex list no
fixedCellHeight list yes
fixedCellWidth list yes
lastVisibleIndex list no
layoutOrientation list yes
leadSelectionIndex selectionno
maxSelectionIndex selectionno
minSelectionIndex selectionno
model list yes
opaque list no
preferredScrollableViewportSizelist no
prototypeCellValue list yes
scrollableTracksViewportHeight list no
scrollableTracksViewportWidth list no
selectedIndex selectionno
selectedIndices selectionno
selectedValue model no
selectedValues model no
selectionBackground list yes
selectionEmpty selectionno
selectionForeground list yes
selectionMode selectionno
selectionModel list yes
UI list yes
UIClassID list no
valueIsAdjusting list no
visibleRowCount list no


Nested Class Summary
protected  class JList.AccessibleJList
          Provides accessibility support for JList.
private  class JList.ListListener
          This private listener propagates javax.swing.event.ListSelectionEvent events from the list's "selectionModel" property to the list's javax.swing.event.ListSelectionListener listeners.
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
(package private)  ListCellRenderer cellRenderer
          This property provides a strategy for rendering cells in the list.
(package private)  boolean dragEnabled
          This property indicates whether "drag and drop" functions are enabled on the list.
(package private)  int fixedCellHeight
          This property indicates an fixed height to assign to all cells in the list.
(package private)  int fixedCellWidth
          This property indicates an fixed width to assign to all cells in the list.
static int HORIZONTAL_WRAP
          Constant value used in "layoutOrientation" property.
(package private)  int layoutOrientation
          This property holds the current layout orientation of the list, which is one of the integer constants VERTICAL 55 , VERTICAL_WRAP 55 , or HORIZONTAL_WRAP 55 .
(package private)  JList.ListListener listListener
          Shared ListListener instance, subscribed to both the current model 55 and selectionModel 55 properties of the list.
(package private)  ListModel model
          This property holds the data elements displayed by the list.
(package private)  java.lang.Object prototypeCellValue
          This property holds a reference to a "prototype" data value -- typically a String -- which is used to calculate the fixedCellWidth 55 and fixedCellHeight 55 properties, using the cellRenderer 55 property to acquire a component to render the prototype.
(package private)  java.awt.Color selectionBackground
          This property specifies a foreground color for the selected cells in the list.
(package private)  java.awt.Color selectionForeground
          This property specifies a background color for the selected cells in the list.
(package private)  ListSelectionModel selectionModel
          This property holds a description of which data elements in the model 55 property should be considered "selected", when displaying and interacting with the list.
private static long serialVersionUID
           
(package private)  boolean valueIsAdjusting
          This property indicates that the list's selection is currently "adjusting" -- perhaps due to a user actively dragging the mouse over multiple list elements -- and is therefore likely to change again in the near future.
static int VERTICAL
          Constant value used in "layoutOrientation" property.
static int VERTICAL_WRAP
          Constant value used in "layoutOrientation" property.
(package private)  int visibleRowCount
          This property indicates a preference for the number of rows displayed in the list, and will scale the getPreferredScrollableViewportSize() 55 property accordingly.
 
Fields inherited from class javax.swing.JComponent
accessibleContext, alignmentX, alignmentY, autoscrolls, border, debugGraphicsOptions, doubleBuffered, isCompletelyDirty, isPaintingDoubleBuffered, listenerList, maximumSize, minimumSize, opaque, preferredSize, requestFocusEnabled, TOOL_TIP_TEXT_KEY, toolTipText, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Container
 
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
JList()
          Creates a new JList object.
JList(ListModel model)
          Creates a new JList object.
JList(java.lang.Object[] items)
          Creates a new JList object.
JList(java.util.Vector items)
          Creates a new JList object.
 
Method Summary
 void addListSelectionListener(javax.swing.event.ListSelectionListener listener)
          Adds a javax.swing.event.ListSelectionListener to the listener list for this list.
 void addSelectionInterval(int anchor, int lead)
          Adds the specified interval to the current selection.
 void clearSelection()
          Clears the current selection.
private  ListModel createListModel(java.lang.Object[] items)
          Returns a ListModel backed by the specified array.
private  ListModel createListModel(java.util.Vector items)
          Returns a ListModel backed by the specified vector.
protected  ListSelectionModel createSelectionModel()
          Creates the default ListSelectionModel.
 void ensureIndexIsVisible(int i)
          Scrolls this list to make the specified cell visible.
protected  void fireSelectionValueChanged(int firstIndex, int lastIndex, boolean isAdjusting)
          Fire a javax.swing.event.ListSelectionEvent to all the registered ListSelectionListeners.
 javax.accessibility.AccessibleContext getAccessibleContext()
          If a component supports the Accessibility API then this method should not return null.
 int getAnchorSelectionIndex()
          Returns the index of the anchor item in the current selection, or -1 if there is no anchor item.
 java.awt.Rectangle getCellBounds(int index0, int index1)
          Returns the bounds of the rectangle that encloses both list cells with index0 and index1.
 ListCellRenderer getCellRenderer()
          Gets the value of the cellRenderer 55 property.
 boolean getDragEnabled()
          Return the value of the dragEnabled property.
 int getFirstVisibleIndex()
          Returns the list index of the upper left or upper right corner of the visible rectangle of this list, depending on the Component.getComponentOrientation()>Component.getComponentOrientation() 55 property.
 int getFixedCellHeight()
          Gets the value of the fixedCellHeight 55 property.
 int getFixedCellWidth()
          Gets the value of the fixedCellWidth 55 property.
 int getLastVisibleIndex()
          Returns the list index of the lower right or lower left corner of the visible rectangle of this list, depending on the Component.getComponentOrientation()>Component.getComponentOrientation() 55 property.
 int getLayoutOrientation()
          Returns the layout orientation.
 int getLeadSelectionIndex()
          Returns the index of the lead item in the current selection, or -1 if there is no lead item.
 javax.swing.event.ListSelectionListener[] getListSelectionListeners()
          Returns an array of all ListSelectionListeners subscribed to this list.
 int getMaxSelectionIndex()
          Returns the highest item index in the current selection, or -1 if there is no selection.
 int getMinSelectionIndex()
          Returns the lowest item index in the current selection, or -1 if there is no selection.
 ListModel getModel()
          Gets the value of the model 55 property.
 int getNextMatch(java.lang.String prefix, int startIndex, javax.swing.text.Position.Bias bias)
          Returns the next list element (beginning from startIndex that starts with prefix.
 java.awt.Dimension getPreferredScrollableViewportSize()
          Returns a size indicating how much space this list would like to consume, when contained in a scrollable viewport.
 java.lang.Object getPrototypeCellValue()
          Returns the current value of the prototypeCellValue 55 property.
 int getScrollableBlockIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)
          Return the number of pixels the list must scroll in order to move a "block" of the list into the provided visible rectangle.
 boolean getScrollableTracksViewportHeight()
          Gets the value of the scrollableTracksViewportWidth property.
 boolean getScrollableTracksViewportWidth()
          Gets the value of the scrollableTracksViewportWidth property.
 int getScrollableUnitIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)
          Return the number of pixels the list must scroll in order to move a "unit" of the list into the provided visible rectangle.
 int getSelectedIndex()
          Returns the minimum index of an element in the list which is currently selected.
 int[] getSelectedIndices()
          Returns the indices of values in the model 55 property which are selected.
 java.lang.Object getSelectedValue()
          Returns the first value in the list's model 55 property which is selected, according to the list's selectionModel 55 property.
 java.lang.Object[] getSelectedValues()
          Returns all the values in the list's model 55 property which are selected, according to the list's selectionModel 55 property.
 java.awt.Color getSelectionBackground()
          Gets the value of the selectionBackground 55 property.
 java.awt.Color getSelectionForeground()
          Gets the value of the selectionForeground 55 property.
 int getSelectionMode()
          Returns the selection mode for the list (one of: ListSelectionModel.SINGLE_SELECTION 55 , ListSelectionModel.SINGLE_INTERVAL_SELECTION 55 and ListSelectionModel.MULTIPLE_INTERVAL_SELECTION 55 ).
 ListSelectionModel getSelectionModel()
          Returns the selection model for the JList.AccessibleJList component.
 javax.swing.plaf.ListUI getUI()
          Gets the value of the UI property.
 java.lang.String getUIClassID()
          Return the class identifier for the list's UI property.
 boolean getValueIsAdjusting()
          Returns the value of the valueIsAdjusting property.
 int getVisibleRowCount()
          Gets the value of the visibleRowCount 55 property.
 java.awt.Point indexToLocation(int index)
          Returns location of the cell located at the specified index in the list.
private  void init(ListModel m)
          Initializes the list.
 boolean isSelectedIndex(int a)
          Indicates whether the list element at a given index value is currently selected.
 boolean isSelectionEmpty()
          Returns true if the model's selection is empty, otherwise false.
 int locationToIndex(java.awt.Point location)
          Returns index of the cell to which specified location is closest to.
protected  java.lang.String paramString()
          Returns a string describing the attributes for the JList component, for use in debugging.
 void removeListSelectionListener(javax.swing.event.ListSelectionListener listener)
          Removes a javax.swing.event.ListSelectionListener from the listener list for this list.
 void removeSelectionInterval(int index0, int index1)
          Removes the specified interval from the current selection.
 void setCellRenderer(ListCellRenderer renderer)
          Sets the value of the getCellRenderer() 55 property.
 void setDragEnabled(boolean enabled)
          Set the dragEnabled property.
 void setFixedCellHeight(int h)
          Sets the value of the fixedCellHeight 55 property.
 void setFixedCellWidth(int w)
          Sets the value of the fixedCellWidth 55 property.
 void setLayoutOrientation(int orientation)
          Sets the layout orientation.
 void setListData(java.lang.Object[] listData)
          Sets the model 55 property of the list to a new anonymous AbstractListModel subclass which accesses the provided Object array directly.
 void setListData(java.util.Vector listData)
          Sets the model 55 property of the list to a new anonymous AbstractListModel subclass which accesses the provided vector directly.
 void setModel(ListModel model)
          Sets the value of the model 55 property.
 void setPrototypeCellValue(java.lang.Object obj)
          Set the prototypeCellValue 55 property.
 void setSelectedIndex(int a)
          Adds the interval [a,a] to the set of selections managed by this list's selectionModel 55 property.
 void setSelectedIndices(int[] a)
          For each element a[i] of the provided array a, calls setSelectedIndex(int) 55 on a[i].
 void setSelectedValue(java.lang.Object obj, boolean scroll)
          Sets the selection to cover only the specified value, if it exists in the model.
 void setSelectionBackground(java.awt.Color c)
          Sets the value of the selectionBackground 55 property.
 void setSelectionForeground(java.awt.Color c)
          Sets the value of the selectionForeground 55 property.
 void setSelectionInterval(int anchor, int lead)
          Sets the current selection to the items in the specified range (inclusive).
 void setSelectionMode(int a)
          Sets the list's "selectionMode" property, which simply mirrors the same property on the list's selectionModel 55 property.
 void setSelectionModel(ListSelectionModel model)
          Sets the value of the selectionModel 55 property.
 void setUI(javax.swing.plaf.ListUI ui)
          Sets the value of the UI property.
 void setValueIsAdjusting(boolean isAdjusting)
          Sets the valueIsAdjusting property.
 void setVisibleRowCount(int vc)
          Sets the value of the visibleRowCount 55 property.
 void updateUI()
          Calls setUI(javax.swing.plaf.ListUI) 55 with the javax.swing.plaf.ListUI subclass returned from calling UIManager.getUI(javax.swing.JComponent) 55 .
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, fireAncestorEvent, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paintImmediately2, paintSimple, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setUIProperty, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateComponentInputMap
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

VERTICAL

public static final int VERTICAL
Constant value used in "layoutOrientation" property. This value means that cells are laid out in a single vertical column. This is the default.

See Also:
Constant Field Values

VERTICAL_WRAP

public static final int VERTICAL_WRAP
Constant value used in "layoutOrientation" property. This value means that cells are laid out in multiple columns "newspaper style", filling vertically first, then horizontally.

See Also:
Constant Field Values

HORIZONTAL_WRAP

public static final int HORIZONTAL_WRAP
Constant value used in "layoutOrientation" property. This value means that cells are laid out in multiple columns "newspaper style", filling horizontally first, then vertically.

See Also:
Constant Field Values

dragEnabled

boolean dragEnabled
This property indicates whether "drag and drop" functions are enabled on the list.


cellRenderer

ListCellRenderer cellRenderer
This property provides a strategy for rendering cells in the list.


fixedCellWidth

int fixedCellWidth
This property indicates an fixed width to assign to all cells in the list. If its value is -1, no width has been assigned. This value can be set explicitly, or implicitly by setting the prototypeCellValue 55 property.


fixedCellHeight

int fixedCellHeight
This property indicates an fixed height to assign to all cells in the list. If its value is -1, no height has been assigned. This value can be set explicitly, or implicitly by setting the prototypeCellValue 55 property.


layoutOrientation

int layoutOrientation
This property holds the current layout orientation of the list, which is one of the integer constants VERTICAL 55 , VERTICAL_WRAP 55 , or HORIZONTAL_WRAP 55 .


model

ListModel model
This property holds the data elements displayed by the list.


prototypeCellValue

java.lang.Object prototypeCellValue

This property holds a reference to a "prototype" data value -- typically a String -- which is used to calculate the fixedCellWidth 55 and fixedCellHeight 55 properties, using the cellRenderer 55 property to acquire a component to render the prototype.

It is important that you not set this value to a component. It has to be a data value such as the objects you would find in the list's model. Setting it to a component will have undefined (and undesirable) affects.


selectionBackground

java.awt.Color selectionBackground
This property specifies a foreground color for the selected cells in the list. When ListCellRenderer.getListCellRendererComponent(javax.swing.JList, java.lang.Object, int, boolean, boolean) 55 is called with a selected cell object, the component returned will have its "foreground" set to this color.


selectionForeground

java.awt.Color selectionForeground
This property specifies a background color for the selected cells in the list. When ListCellRenderer.getListCellRendererComponent(javax.swing.JList, java.lang.Object, int, boolean, boolean) 55 is called with a selected cell object, the component returned will have its "background" property set to this color.


selectionModel

ListSelectionModel selectionModel
This property holds a description of which data elements in the model 55 property should be considered "selected", when displaying and interacting with the list.


valueIsAdjusting

boolean valueIsAdjusting
This property indicates that the list's selection is currently "adjusting" -- perhaps due to a user actively dragging the mouse over multiple list elements -- and is therefore likely to change again in the near future. A javax.swing.event.ListSelectionListener might choose to delay updating its view of the list's selection until this property is false, meaning that the adjustment has completed.


visibleRowCount

int visibleRowCount
This property indicates a preference for the number of rows displayed in the list, and will scale the getPreferredScrollableViewportSize() 55 property accordingly. The actual number of displayed rows, when the list is placed in a real JViewport or other component, may be greater or less than this number.


listListener

JList.ListListener listListener
Shared ListListener instance, subscribed to both the current model 55 and selectionModel 55 properties of the list.

Constructor Detail

JList

public JList()
Creates a new JList object.


JList

public JList(java.lang.Object[] items)
Creates a new JList object.


JList

public JList(java.util.Vector items)
Creates a new JList object.


JList

public JList(ListModel model)
Creates a new JList object.

Method Detail

fireSelectionValueChanged

protected void fireSelectionValueChanged(int firstIndex,
                                         int lastIndex,
                                         boolean isAdjusting)
Fire a javax.swing.event.ListSelectionEvent to all the registered ListSelectionListeners.


init

private void init(ListModel m)
Initializes the list.


createSelectionModel

protected ListSelectionModel createSelectionModel()
Creates the default ListSelectionModel.


getFixedCellHeight

public int getFixedCellHeight()
Gets the value of the fixedCellHeight 55 property. This property may be -1 to indicate that no cell height has been set. This property is also set implicitly when the prototypeCellValue 55 property is set.


setFixedCellHeight

public void setFixedCellHeight(int h)
Sets the value of the fixedCellHeight 55 property. This property may be -1 to indicate that no cell height has been set. This property is also set implicitly when the prototypeCellValue 55 property is set, but setting it explicitly overrides the height computed from prototypeCellValue 55 .


getFixedCellWidth

public int getFixedCellWidth()
Gets the value of the fixedCellWidth 55 property. This property may be -1 to indicate that no cell width has been set. This property is also set implicitly when the prototypeCellValue 55 property is set.


setFixedCellWidth

public void setFixedCellWidth(int w)
Sets the value of the fixedCellWidth 55 property. This property may be -1 to indicate that no cell width has been set. This property is also set implicitly when the prototypeCellValue 55 property is set, but setting it explicitly overrides the width computed from prototypeCellValue 55 .


getVisibleRowCount

public int getVisibleRowCount()
Gets the value of the visibleRowCount 55 property.


setVisibleRowCount

public void setVisibleRowCount(int vc)
Sets the value of the visibleRowCount 55 property.


addListSelectionListener

public void addListSelectionListener(javax.swing.event.ListSelectionListener listener)
Adds a javax.swing.event.ListSelectionListener to the listener list for this list. The listener will be called back with a javax.swing.event.ListSelectionEvent any time the list's selectionModel 55 property changes. The source of such events will be the JList, not the selection model.


removeListSelectionListener

public void removeListSelectionListener(javax.swing.event.ListSelectionListener listener)
Removes a javax.swing.event.ListSelectionListener from the listener list for this list. The listener will no longer be called when the list's selectionModel 55 changes.


getListSelectionListeners

public javax.swing.event.ListSelectionListener[] getListSelectionListeners()
Returns an array of all ListSelectionListeners subscribed to this list.

Since:
1.4

getSelectionMode

public int getSelectionMode()
Returns the selection mode for the list (one of: ListSelectionModel.SINGLE_SELECTION 55 , ListSelectionModel.SINGLE_INTERVAL_SELECTION 55 and ListSelectionModel.MULTIPLE_INTERVAL_SELECTION 55 ).


setSelectionMode

public void setSelectionMode(int a)
Sets the list's "selectionMode" property, which simply mirrors the same property on the list's selectionModel 55 property. This property should be one of the integer constants SINGLE_SELECTION, SINGLE_INTERVAL_SELECTION, or MULTIPLE_INTERVAL_SELECTION from the ListSelectionModel interface.


setSelectedIndex

public void setSelectedIndex(int a)
Adds the interval [a,a] to the set of selections managed by this list's selectionModel 55 property. Depending on the selection mode, this may cause existing selections to become invalid, or may simply expand the set of selections.


setSelectedIndices

public void setSelectedIndices(int[] a)
For each element a[i] of the provided array a, calls setSelectedIndex(int) 55 on a[i].


getSelectedIndex

public int getSelectedIndex()
Returns the minimum index of an element in the list which is currently selected.


isSelectionEmpty

public boolean isSelectionEmpty()
Returns true if the model's selection is empty, otherwise false.


getFirstVisibleIndex

public int getFirstVisibleIndex()
Returns the list index of the upper left or upper right corner of the visible rectangle of this list, depending on the Component.getComponentOrientation()>Component.getComponentOrientation() 55 property.


locationToIndex

public int locationToIndex(java.awt.Point location)
Returns index of the cell to which specified location is closest to. If the location is outside the bounds of the list, then the greatest index in the list model is returned. If the list model is empty, then -1 is returned.


indexToLocation

public java.awt.Point indexToLocation(int index)
Returns location of the cell located at the specified index in the list.


getLastVisibleIndex

public int getLastVisibleIndex()
Returns the list index of the lower right or lower left corner of the visible rectangle of this list, depending on the Component.getComponentOrientation()>Component.getComponentOrientation() 55 property.


getSelectedIndices

public int[] getSelectedIndices()
Returns the indices of values in the model 55 property which are selected.


isSelectedIndex

public boolean isSelectedIndex(int a)
Indicates whether the list element at a given index value is currently selected.


getSelectedValue

public java.lang.Object getSelectedValue()
Returns the first value in the list's model 55 property which is selected, according to the list's selectionModel 55 property. This is equivalent to calling getModel()getElementAt(getSelectedIndex()), with a check for the special index value of -1 which returns null null.


getSelectedValues

public java.lang.Object[] getSelectedValues()
Returns all the values in the list's model 55 property which are selected, according to the list's selectionModel 55 property.


getSelectionBackground

public java.awt.Color getSelectionBackground()
Gets the value of the selectionBackground 55 property.


setSelectionBackground

public void setSelectionBackground(java.awt.Color c)
Sets the value of the selectionBackground 55 property.


getSelectionForeground

public java.awt.Color getSelectionForeground()
Gets the value of the selectionForeground 55 property.


setSelectionForeground

public void setSelectionForeground(java.awt.Color c)
Sets the value of the selectionForeground 55 property.


setSelectedValue

public void setSelectedValue(java.lang.Object obj,
                             boolean scroll)
Sets the selection to cover only the specified value, if it exists in the model.


ensureIndexIsVisible

public void ensureIndexIsVisible(int i)
Scrolls this list to make the specified cell visible. This only works if the list is contained within a viewport.


setListData

public void setListData(java.lang.Object[] listData)
Sets the model 55 property of the list to a new anonymous AbstractListModel subclass which accesses the provided Object array directly.


createListModel

private ListModel createListModel(java.lang.Object[] items)
Returns a ListModel backed by the specified array.


createListModel

private ListModel createListModel(java.util.Vector items)
Returns a ListModel backed by the specified vector.


setListData

public void setListData(java.util.Vector listData)
Sets the model 55 property of the list to a new anonymous AbstractListModel subclass which accesses the provided vector directly.


getCellRenderer

public ListCellRenderer getCellRenderer()
Gets the value of the cellRenderer 55 property.


setCellRenderer

public void setCellRenderer(ListCellRenderer renderer)
Sets the value of the getCellRenderer() 55 property.


getModel

public ListModel getModel()
Gets the value of the model 55 property.


setModel

public void setModel(ListModel model)
Sets the value of the model 55 property. The list's listListener 55 is unsubscribed from the existing model, if it exists, and re-subscribed to the new model.


getSelectionModel

public ListSelectionModel getSelectionModel()
Returns the selection model for the JList.AccessibleJList component. Note that this class contains a range of convenience methods for configuring the selection model:


setSelectionModel

public void setSelectionModel(ListSelectionModel model)
Sets the value of the selectionModel 55 property. The list's listListener 55 is unsubscribed from the existing selection model, if it exists, and re-subscribed to the new selection model.


getUI

public javax.swing.plaf.ListUI getUI()
Gets the value of the UI property.


setUI

public void setUI(javax.swing.plaf.ListUI ui)
Sets the value of the UI property.


updateUI

public void updateUI()
Calls setUI(javax.swing.plaf.ListUI) 55 with the javax.swing.plaf.ListUI subclass returned from calling UIManager.getUI(javax.swing.JComponent) 55 .

Overrides:
updateUI in class JComponent

getUIClassID

public java.lang.String getUIClassID()
Return the class identifier for the list's UI property. This should be the constant string "ListUI", and map to an appropriate UI class in the UIManager.

Overrides:
getUIClassID in class JComponent

getPrototypeCellValue

public java.lang.Object getPrototypeCellValue()
Returns the current value of the prototypeCellValue 55 property. This property holds a reference to a "prototype" data value -- typically a String -- which is used to calculate the fixedCellWidth 55 and fixedCellHeight 55 properties, using the cellRenderer 55 property to acquire a component to render the prototype.


setPrototypeCellValue

public void setPrototypeCellValue(java.lang.Object obj)

Set the prototypeCellValue 55 property. This property holds a reference to a "prototype" data value -- typically a String -- which is used to calculate the fixedCellWidth 55 and fixedCellHeight 55 properties, using the cellRenderer 55 property to acquire a component to render the prototype.

It is important that you not set this value to a component. It has to be a data value such as the objects you would find in the list's model. Setting it to a component will have undefined (and undesirable) affects.


getAccessibleContext

public javax.accessibility.AccessibleContext getAccessibleContext()
Description copied from interface: javax.accessibility.Accessible
If a component supports the Accessibility API then this method should not return null. Only classes which must extend an accessible class, but must not itself be accessible, may return null.

Specified by: