javax.swing
Class JList

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.awt.Component sample code for java.awt.Component definition code for java.awt.Component 
      extended by java.awt.Container sample code for java.awt.Container definition code for java.awt.Container 
          extended by javax.swing.JComponent sample code for javax.swing.JComponent definition code for javax.swing.JComponent 
              extended by javax.swing.JList
All Implemented Interfaces:
ImageObserver sample code for java.awt.image.ImageObserver definition code for java.awt.image.ImageObserver , MenuContainer sample code for java.awt.MenuContainer definition code for java.awt.MenuContainer , Serializable sample code for java.io.Serializable definition code for java.io.Serializable , Accessible sample code for javax.accessibility.Accessible definition code for javax.accessibility.Accessible , Scrollable sample code for javax.swing.Scrollable definition code for javax.swing.Scrollable

public class JList
extends JComponent sample code for javax.swing.JComponent definition code for javax.swing.JComponent
implements Scrollable sample code for javax.swing.Scrollable definition code for javax.swing.Scrollable , Accessible sample code for javax.accessibility.Accessible definition code for javax.accessibility.Accessible

A component that allows the user to select one or more objects from a list. A separate model, ListModel, represents the contents of the list. It's easy to display an array or vector of objects, using a JList constructor that builds a ListModel instance for you:

 // Create a JList that displays the strings in data[]

 String[] data = {"one", "two", "three", "four"};
 JList dataList = new JList(data);
 
 // The value of the JList model property is an object that provides
 // a read-only view of the data.  It was constructed automatically.

 for(int i = 0; i < dataList.getModel().getSize(); i++) {
     System.out.println(dataList.getModel().getElementAt(i));
 }

 // Create a JList that displays the superclass of JList.class.
 // We store the superclasses in a java.util.Vector.

 Vector superClasses = new Vector();
 Class rootClass = javax.swing.JList.class;
 for(Class cls = rootClass; cls != null; cls = cls.getSuperclass()) {
     superClasses.addElement(cls);
 }
 JList classList = new JList(superClasses);
 

JList doesn't support scrolling directly. To create a scrolling list you make the JList the viewport view of a JScrollPane. For example:

 JScrollPane scrollPane = new JScrollPane(dataList);
 // Or in two steps:
 JScrollPane scrollPane = new JScrollPane();
 scrollPane.getViewport().setView(dataList);
 

By default the JList selection model allows any combination of items to be selected at a time, using the constant MULTIPLE_INTERVAL_SELECTION. The selection state is actually managed by a separate delegate object, an instance of ListSelectionModel. However JList provides convenient properties for managing the selection.

 String[] data = {"one", "two", "three", "four"};
 JList dataList = new JList(data);

 dataList.setSelectedIndex(1);  // select "two"
 dataList.getSelectedValue();   // returns "two"
 

The contents of a JList can be dynamic, in other words, the list elements can change value and the size of the list can change after the JList has been created. The JList observes changes in its model with a swing.event.ListDataListener implementation. A correct implementation of ListModel notifies it's listeners each time a change occurs. The changes are characterized by a swing.event.ListDataEvent, which identifies the range of list indices that have been modified, added, or removed. Simple dynamic-content JList applications can use the DefaultListModel class to store list elements. This class implements the ListModel interface and provides the java.util.Vector API as well. Applications that need to provide custom ListModel implementations can subclass AbstractListModel, which provides basic ListDataListener support. For example:

 // This list model has about 2^16 elements.  Enjoy scrolling.

 
 ListModel bigData = new AbstractListModel() {
     public int getSize() { return Short.MAX_VALUE; }
     public Object getElementAt(int index) { return "Index " + index; }
 };

 JList bigDataList = new JList(bigData);

 // We don't want the JList implementation to compute the width
 // or height of all of the list cells, so we give it a string
 // that's as big as we'll need for any cell.  It uses this to
 // compute values for the fixedCellWidth and fixedCellHeight
 // properties.

 bigDataList.setPrototypeCellValue("Index 1234567890");
 

JList uses a java.awt.Component, provided by a delegate called the cellRendererer, to paint the visible cells in the list. The cell renderer component is used like a "rubber stamp" to paint each visible row. Each time the JList needs to paint a cell it asks the cell renderer for the component, moves it into place using setBounds() and then draws it by calling its paint method. The default cell renderer uses a JLabel component to render the string value of each component. You can substitute your own cell renderer, using code like this:

  // Display an icon and a string for each object in the list.

 
 class MyCellRenderer extends JLabel implements ListCellRenderer {
     final static ImageIcon longIcon = new ImageIcon("long.gif");
     final static ImageIcon shortIcon = new ImageIcon("short.gif");

     // This is the only method defined by ListCellRenderer.
     // We just reconfigure the JLabel each time we're called.

     public Component getListCellRendererComponent(
       JList list,
       Object value,            // value to display
       int index,               // cell index
       boolean isSelected,      // is the cell selected
       boolean cellHasFocus)    // the list and the cell have the focus
     {
         String s = value.toString();
         setText(s);
         setIcon((s.length() > 10) ? longIcon : shortIcon);
           if (isSelected) {
             setBackground(list.getSelectionBackground());
               setForeground(list.getSelectionForeground());
           }
         else {
               setBackground(list.getBackground());
               setForeground(list.getForeground());
           }
           setEnabled(list.isEnabled());
           setFont(list.getFont());
         setOpaque(true);
         return this;
     }
 }

 String[] data = {"one", "two", "three", "four"};
 JList dataList = new JList(data);
 dataList.setCellRenderer(new MyCellRenderer());
 

JList doesn't provide any special support for handling double or triple (or N) mouse clicks however it's easy to handle them using a MouseListener. Use the JList method locationToIndex() to determine what cell was clicked. For example:

 final JList list = new JList(dataModel);
 MouseListener mouseListener = new MouseAdapter() {
     public void mouseClicked(MouseEvent e) {
         if (e.getClickCount() == 2) {
             int index = list.locationToIndex(e.getPoint());
             System.out.println("Double clicked on Item " + index);
          }
     }
 };
 list.addMouseListener(mouseListener);
 
Note that in this example the dataList is final because it's referred to by the anonymous MouseListener class.

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 JavaBeansTM has been added to the java.beans package. Please see XMLEncoder sample code for java.beans.XMLEncoder definition code for java.beans.XMLEncoder .

See How to Use Lists in The Java Tutorial for further documentation. Also see the article Advanced JList Programming in The Swing Connection.

See Also:
ListModel sample code for javax.swing.ListModel definition code for javax.swing.ListModel , AbstractListModel sample code for javax.swing.AbstractListModel definition code for javax.swing.AbstractListModel , DefaultListModel sample code for javax.swing.DefaultListModel definition code for javax.swing.DefaultListModel , ListSelectionModel sample code for javax.swing.ListSelectionModel definition code for javax.swing.ListSelectionModel , DefaultListSelectionModel sample code for javax.swing.DefaultListSelectionModel definition code for javax.swing.DefaultListSelectionModel , ListCellRenderer sample code for javax.swing.ListCellRenderer definition code for javax.swing.ListCellRenderer , Serialized Form

Nested Class Summary
protected  class JList.AccessibleJList sample code for javax.swing.JList.AccessibleJList definition code for javax.swing.JList.AccessibleJList
          This class implements accessibility support for the JList class.
 
Nested classes/interfaces inherited from class javax.swing.JComponent sample code for javax.swing.JComponent definition code for javax.swing.JComponent
JComponent.AccessibleJComponent sample code for javax.swing.JComponent.AccessibleJComponent definition code for javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container sample code for java.awt.Container definition code for java.awt.Container
Container.AccessibleAWTContainer sample code for java.awt.Container.AccessibleAWTContainer definition code for java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component sample code for java.awt.Component definition code for java.awt.Component
Component.AccessibleAWTComponent sample code for java.awt.Component.AccessibleAWTComponent definition code for java.awt.Component.AccessibleAWTComponent , Component.BltBufferStrategy sample code for java.awt.Component.BltBufferStrategy definition code for java.awt.Component.BltBufferStrategy , Component.FlipBufferStrategy sample code for java.awt.Component.FlipBufferStrategy definition code for java.awt.Component.FlipBufferStrategy
 
Field Summary
static int HORIZONTAL_WRAP sample code for javax.swing.JList.HORIZONTAL_WRAP definition code for javax.swing.JList.HORIZONTAL_WRAP
          Indicates "newspaper style" with the cells flowing horizontally then vertically.
static int VERTICAL sample code for javax.swing.JList.VERTICAL definition code for javax.swing.JList.VERTICAL
          Indicates the default layout: one column of cells.
static int VERTICAL_WRAP sample code for javax.swing.JList.VERTICAL_WRAP definition code for javax.swing.JList.VERTICAL_WRAP
          Indicates "newspaper style" layout with the cells flowing vertically then horizontally.
 
Fields inherited from class javax.swing.JComponent sample code for javax.swing.JComponent definition code for javax.swing.JComponent
accessibleContext sample code for javax.swing.JComponent.accessibleContext definition code for javax.swing.JComponent.accessibleContext , listenerList sample code for javax.swing.JComponent.listenerList definition code for javax.swing.JComponent.listenerList , TOOL_TIP_TEXT_KEY sample code for javax.swing.JComponent.TOOL_TIP_TEXT_KEY definition code for javax.swing.JComponent.TOOL_TIP_TEXT_KEY , ui sample code for javax.swing.JComponent.ui definition code for javax.swing.JComponent.ui , UNDEFINED_CONDITION sample code for javax.swing.JComponent.UNDEFINED_CONDITION definition code for javax.swing.JComponent.UNDEFINED_CONDITION , WHEN_ANCESTOR_OF_FOCUSED_COMPONENT sample code for javax.swing.JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT definition code for javax.swing.JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT , WHEN_FOCUSED sample code for javax.swing.JComponent.WHEN_FOCUSED definition code for javax.swing.JComponent.WHEN_FOCUSED , WHEN_IN_FOCUSED_WINDOW sample code for javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW definition code for javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component sample code for java.awt.Component definition code for java.awt.Component
BOTTOM_ALIGNMENT sample code for java.awt.Component.BOTTOM_ALIGNMENT definition code for java.awt.Component.BOTTOM_ALIGNMENT , CENTER_ALIGNMENT sample code for java.awt.Component.CENTER_ALIGNMENT definition code for java.awt.Component.CENTER_ALIGNMENT , LEFT_ALIGNMENT sample code for java.awt.Component.LEFT_ALIGNMENT definition code for java.awt.Component.LEFT_ALIGNMENT , RIGHT_ALIGNMENT sample code for java.awt.Component.RIGHT_ALIGNMENT definition code for java.awt.Component.RIGHT_ALIGNMENT , TOP_ALIGNMENT sample code for java.awt.Component.TOP_ALIGNMENT definition code for java.awt.Component.TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver sample code for java.awt.image.ImageObserver definition code for java.awt.image.ImageObserver
ABORT sample code for java.awt.image.ImageObserver.ABORT definition code for java.awt.image.ImageObserver.ABORT , ALLBITS sample code for java.awt.image.ImageObserver.ALLBITS definition code for java.awt.image.ImageObserver.ALLBITS , ERROR sample code for java.awt.image.ImageObserver.ERROR definition code for java.awt.image.ImageObserver.ERROR , FRAMEBITS sample code for java.awt.image.ImageObserver.FRAMEBITS definition code for java.awt.image.ImageObserver.FRAMEBITS , HEIGHT sample code for java.awt.image.ImageObserver.HEIGHT definition code for java.awt.image.ImageObserver.HEIGHT , PROPERTIES sample code for java.awt.image.ImageObserver.PROPERTIES definition code for java.awt.image.ImageObserver.PROPERTIES , SOMEBITS sample code for java.awt.image.ImageObserver.SOMEBITS definition code for java.awt.image.ImageObserver.SOMEBITS , WIDTH sample code for java.awt.image.ImageObserver.WIDTH definition code for java.awt.image.ImageObserver.WIDTH
 
Constructor Summary
JList sample code for javax.swing.JList.JList() definition code for javax.swing.JList.JList() ()
          Constructs a JList with an empty model.
JList sample code for javax.swing.JList.JList(javax.swing.ListModel) definition code for javax.swing.JList.JList(javax.swing.ListModel) (ListModel sample code for javax.swing.ListModel definition code for javax.swing.ListModel  dataModel)
          Constructs a JList that displays the elements in the specified, non-null model.
JList sample code for javax.swing.JList.JList(java.lang.Object[]) definition code for javax.swing.JList.JList(java.lang.Object[]) (Object sample code for java.lang.Object definition code for java.lang.Object [] listData)
          Constructs a JList that displays the elements in the specified array.
JList sample code for javax.swing.JList.JList(java.util.Vector) definition code for javax.swing.JList.JList(java.util.Vector) (Vector sample code for java.util.Vector definition code for java.util.Vector <?> listData)
          Constructs a JList that displays the elements in the specified Vector.
 
Method Summary
 void addListSelectionListener sample code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener) (ListSelectionListener sample code for javax.swing.event.ListSelectionListener definition code for javax.swing.event.ListSelectionListener  listener)
          Adds a listener to the list that's notified each time a change to the selection occurs.
 void addSelectionInterval sample code for javax.swing.JList.addSelectionInterval(int, int) definition code for javax.swing.JList.addSelectionInterval(int, int) (int anchor, int lead)
          Sets the selection to be the union of the specified interval with current selection.
 void clearSelection sample code for javax.swing.JList.clearSelection() definition code for javax.swing.JList.clearSelection() ()
          Clears the selection - after calling this method isSelectionEmpty will return true.
protected  ListSelectionModel sample code for javax.swing.ListSelectionModel definition code for javax.swing.ListSelectionModel createSelectionModel sample code for javax.swing.JList.createSelectionModel() definition code for javax.swing.JList.createSelectionModel() ()
          Returns an instance of DefaultListSelectionModel.
 void ensureIndexIsVisible sample code for javax.swing.JList.ensureIndexIsVisible(int) definition code for javax.swing.JList.ensureIndexIsVisible(int) (int index)
          Scrolls the viewport to make the specified cell completely visible.
protected  void fireSelectionValueChanged sample code for javax.swing.JList.fireSelectionValueChanged(int, int, boolean) definition code for javax.swing.JList.fireSelectionValueChanged(int, int, boolean) (int firstIndex, int lastIndex, boolean isAdjusting)
          Notifies JList ListSelectionListeners that the selection model has changed.
 AccessibleContext sample code for javax.accessibility.AccessibleContext definition code for javax.accessibility.AccessibleContext getAccessibleContext sample code for javax.swing.JList.getAccessibleContext() definition code for javax.swing.JList.getAccessibleContext() ()
          Gets the AccessibleContext associated with this JList.
 int getAnchorSelectionIndex sample code for javax.swing.JList.getAnchorSelectionIndex() definition code for javax.swing.JList.getAnchorSelectionIndex() ()
          Returns the first index argument from the most recent addSelectionModel or setSelectionInterval call.
 Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle getCellBounds sample code for javax.swing.JList.getCellBounds(int, int) definition code for javax.swing.JList.getCellBounds(int, int) (int index0, int index1)
          Returns the bounds of the specified range of items in JList coordinates.
 ListCellRenderer sample code for javax.swing.ListCellRenderer definition code for javax.swing.ListCellRenderer getCellRenderer sample code for javax.swing.JList.getCellRenderer() definition code for javax.swing.JList.getCellRenderer() ()
          Returns the object that renders the list items.
 boolean getDragEnabled sample code for javax.swing.JList.getDragEnabled() definition code for javax.swing.JList.getDragEnabled() ()
          Gets the dragEnabled property.
 int getFirstVisibleIndex sample code for javax.swing.JList.getFirstVisibleIndex() definition code for javax.swing.JList.getFirstVisibleIndex() ()
          Returns the index of the first visible cell.
 int getFixedCellHeight sample code for javax.swing.JList.getFixedCellHeight() definition code for javax.swing.JList.getFixedCellHeight() ()
          Returns the fixed cell height value -- the value specified by setting the fixedCellHeight property, rather than that calculated from the list elements.
 int getFixedCellWidth sample code for javax.swing.JList.getFixedCellWidth() definition code for javax.swing.JList.getFixedCellWidth() ()
          Returns the fixed cell width value -- the value specified by setting the fixedCellWidth property, rather than that calculated from the list elements.
 int getLastVisibleIndex sample code for javax.swing.JList.getLastVisibleIndex() definition code for javax.swing.JList.getLastVisibleIndex() ()
          Returns the index of the last visible cell.
 int getLayoutOrientation sample code for javax.swing.JList.getLayoutOrientation() definition code for javax.swing.JList.getLayoutOrientation() ()
          Returns JList.VERTICAL if the layout is a single column of cells, or JList.VERTICAL_WRAP if the layout is "newspaper style" with the content flowing vertically then horizontally or JList.HORIZONTAL_WRAP if the layout is "newspaper style" with the content flowing horizontally then vertically.
 int getLeadSelectionIndex sample code for javax.swing.JList.getLeadSelectionIndex() definition code for javax.swing.JList.getLeadSelectionIndex() ()
          Returns the second index argument from the most recent addSelectionInterval or setSelectionInterval call.
 ListSelectionListener sample code for javax.swing.event.ListSelectionListener definition code for javax.swing.event.ListSelectionListener [] getListSelectionListeners sample code for javax.swing.JList.getListSelectionListeners() definition code for javax.swing.JList.getListSelectionListeners() ()
          Returns an array of all the ListSelectionListeners added to this JList with addListSelectionListener().
 int getMaxSelectionIndex sample code for javax.swing.JList.getMaxSelectionIndex() definition code for javax.swing.JList.getMaxSelectionIndex() ()
          Returns the largest selected cell index.
 int getMinSelectionIndex sample code for javax.swing.JList.getMinSelectionIndex() definition code for javax.swing.JList.getMinSelectionIndex() ()
          Returns the smallest selected cell index.
 ListModel sample code for javax.swing.ListModel definition code for javax.swing.ListModel getModel sample code for javax.swing.JList.getModel() definition code for javax.swing.JList.getModel() ()
          Returns the data model that holds the list of items displayed by the JList component.
 int getNextMatch sample code for javax.swing.JList.getNextMatch(java.lang.String, int, javax.swing.text.Position.Bias) definition code for javax.swing.JList.getNextMatch(java.lang.String, int, javax.swing.text.Position.Bias) (String sample code for java.lang.String definition code for java.lang.String  prefix, int startIndex, Position.Bias sample code for javax.swing.text.Position.Bias definition code for javax.swing.text.Position.Bias  bias)
          Returns the next list element that starts with a prefix.
 Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension getPreferredScrollableViewportSize sample code for javax.swing.JList.getPreferredScrollableViewportSize() definition code for javax.swing.JList.getPreferredScrollableViewportSize() ()
          Computes the size of the viewport needed to display visibleRowCount rows.
 Object sample code for java.lang.Object definition code for java.lang.Object getPrototypeCellValue sample code for javax.swing.JList.getPrototypeCellValue() definition code for javax.swing.JList.getPrototypeCellValue() ()
          Returns the cell width of the "prototypical cell" -- a cell used for the calculation of cell widths, because it has the same value as all other list items.
 int getScrollableBlockIncrement sample code for javax.swing.JList.getScrollableBlockIncrement(java.awt.Rectangle, int, int) definition code for javax.swing.JList.getScrollableBlockIncrement(java.awt.Rectangle, int, int) (Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  visibleRect, int orientation, int direction)
          Returns the distance to scroll to expose the next or previous block.
 boolean getScrollableTracksViewportHeight sample code for javax.swing.JList.getScrollableTracksViewportHeight() definition code for javax.swing.JList.getScrollableTracksViewportHeight() ()
          Returns true if this JList is displayed in a JViewport and the viewport is taller than JList's preferred height, or if the layout orientation is VERTICAL_WRAP and the number of visible rows is <= 0; otherwise returns false.
 boolean getScrollableTracksViewportWidth sample code for javax.swing.JList.getScrollableTracksViewportWidth() definition code for javax.swing.JList.getScrollableTracksViewportWidth() ()
          Returns true if this JList is displayed in a JViewport and the viewport is wider than JList's preferred width; or if the layout orientation is HORIZONTAL_WRAP and the visible row count is <= 0; otherwise returns false.
 int getScrollableUnitIncrement sample code for javax.swing.JList.getScrollableUnitIncrement(java.awt.Rectangle, int, int) definition code for javax.swing.JList.getScrollableUnitIncrement(java.awt.Rectangle, int, int) (Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  visibleRect, int orientation, int direction)
          Returns the distance to scroll to expose the next or previous row (for vertical scrolling) or column (for horizontal scrolling).
 int getSelectedIndex sample code for javax.swing.JList.getSelectedIndex() definition code for javax.swing.JList.getSelectedIndex() ()
          Returns the first selected index; returns -1 if there is no selected item.
 int[] getSelectedIndices sample code for javax.swing.JList.getSelectedIndices() definition code for javax.swing.JList.getSelectedIndices() ()
          Returns an array of all of the selected indices in increasing order.
 Object sample code for java.lang.Object definition code for java.lang.Object getSelectedValue sample code for javax.swing.JList.getSelectedValue() definition code for javax.swing.JList.getSelectedValue() ()
          Returns the first selected value, or null if the selection is empty.
 Object sample code for java.lang.Object definition code for java.lang.Object [] getSelectedValues sample code for javax.swing.JList.getSelectedValues() definition code for javax.swing.JList.getSelectedValues() ()
          Returns an array of the values for the selected cells.
 Color sample code for java.awt.Color definition code for java.awt.Color getSelectionBackground sample code for javax.swing.JList.getSelectionBackground() definition code for javax.swing.JList.getSelectionBackground() ()
          Returns the background color for selected cells.
 Color sample code for java.awt.Color definition code for java.awt.Color getSelectionForeground sample code for javax.swing.JList.getSelectionForeground() definition code for javax.swing.JList.getSelectionForeground() ()
          Returns the selection foreground color.
 int getSelectionMode sample code for javax.swing.JList.getSelectionMode() definition code for javax.swing.JList.getSelectionMode() ()
          Returns whether single-item or multiple-item selections are allowed.
 ListSelectionModel sample code for javax.swing.ListSelectionModel definition code for javax.swing.ListSelectionModel getSelectionModel sample code for javax.swing.JList.getSelectionModel() definition code for javax.swing.JList.getSelectionModel() ()
          Returns the value of the current selection model.
 String sample code for java.lang.String definition code for java.lang.String getToolTipText sample code for javax.swing.JList.getToolTipText(java.awt.event.MouseEvent) definition code for javax.swing.JList.getToolTipText(java.awt.event.MouseEvent) (MouseEvent sample code for java.awt.event.MouseEvent definition code for java.awt.event.MouseEvent  event)
          Overrides JComponent's getToolTipText method in order to allow the renderer's tips to be used if it has text set.
 ListUI sample code for javax.swing.plaf.ListUI definition code for javax.swing.plaf.ListUI getUI sample code for javax.swing.JList.getUI() definition code for javax.swing.JList.getUI() ()
          Returns the look and feel (L&F) object that renders this component.
 String sample code for java.lang.String definition code for java.lang.String getUIClassID sample code for javax.swing.JList.getUIClassID() definition code for javax.swing.JList.getUIClassID() ()
          Returns the suffix used to construct the name of the look and feel (L&F) class used to render this component.
 boolean getValueIsAdjusting sample code for javax.swing.JList.getValueIsAdjusting() definition code for javax.swing.JList.getValueIsAdjusting() ()
          Returns the value of the data model's isAdjusting property.
 int getVisibleRowCount sample code for javax.swing.JList.getVisibleRowCount() definition code for javax.swing.JList.getVisibleRowCount() ()
          Returns the preferred number of visible rows.
 Point sample code for java.awt.Point definition code for java.awt.Point indexToLocation sample code for javax.swing.JList.indexToLocation(int) definition code for javax.swing.JList.indexToLocation(int) (int index)
          Returns the origin of the specified item in JList coordinates.
 boolean isSelectedIndex sample code for javax.swing.JList.isSelectedIndex(int) definition code for javax.swing.JList.isSelectedIndex(int) (int index)
          Returns true if the specified index is selected.
 boolean isSelectionEmpty sample code for javax.swing.JList.isSelectionEmpty() definition code for javax.swing.JList.isSelectionEmpty() ()
          Returns true if nothing is selected.
 int locationToIndex sample code for javax.swing.JList.locationToIndex(java.awt.Point) definition code for javax.swing.JList.locationToIndex(java.awt.Point) (Point sample code for java.awt.Point definition code for java.awt.Point  location)
          Convert a point in JList coordinates to the closest index of the cell at that location.
protected  String sample code for java.lang.String definition code for java.lang.String paramString sample code for javax.swing.JList.paramString() definition code for javax.swing.JList.paramString() ()
          Returns a string representation of this JList.
 void removeListSelectionListener sample code for javax.swing.JList.removeListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.JList.removeListSelectionListener(javax.swing.event.ListSelectionListener) (ListSelectionListener sample code for javax.swing.event.ListSelectionListener definition code for javax.swing.event.ListSelectionListener  listener)
          Removes a listener from the list that's notified each time a change to the selection occurs.
 void removeSelectionInterval sample code for javax.swing.JList.removeSelectionInterval(int, int) definition code for javax.swing.JList.removeSelectionInterval(int, int) (int index0, int index1)
          Sets the selection to be the set difference of the specified interval and the current selection.
 void setCellRenderer sample code for javax.swing.JList.setCellRenderer(javax.swing.ListCellRenderer) definition code for javax.swing.JList.setCellRenderer(javax.swing.ListCellRenderer) (ListCellRenderer sample code for javax.swing.ListCellRenderer definition code for javax.swing.ListCellRenderer  cellRenderer)
          Sets the delegate that's used to paint each cell in the list.
 void setDragEnabled sample code for javax.swing.JList.setDragEnabled(boolean) definition code for javax.swing.JList.setDragEnabled(boolean) (boolean b)
          Sets the dragEnabled property, which must be true to enable automatic drag handling (the first part of drag and drop) on this component.
 void setFixedCellHeight sample code for javax.swing.JList.setFixedCellHeight(int) definition code for javax.swing.JList.setFixedCellHeight(int) (int height)
          Sets the height of every cell in the list.
 void setFixedCellWidth sample code for javax.swing.JList.setFixedCellWidth(int) definition code for javax.swing.JList.setFixedCellWidth(int) (int width)
          Sets the width of every cell in the list.
 void setLayoutOrientation sample code for javax.swing.JList.setLayoutOrientation(int) definition code for javax.swing.JList.setLayoutOrientation(int) (int layoutOrientation)
          Defines the way list cells are layed out.
 void setListData sample code for javax.swing.JList.setListData(java.lang.Object[]) definition code for javax.swing.JList.setListData(java.lang.Object[]) (Object sample code for java.lang.Object definition code for java.lang.Object [] listData)
          Constructs a ListModel from an array of objects and then applies setModel to it.
 void setListData sample code for javax.swing.JList.setListData(java.util.Vector) definition code for javax.swing.JList.setListData(java.util.Vector) (Vector