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 sample code for java.util.Vector definition code for java.util.Vector <?> listData)
          Constructs a ListModel from a Vector and then applies setModel to it.
 void setModel sample code for javax.swing.JList.setModel(javax.swing.ListModel) definition code for javax.swing.JList.setModel(javax.swing.ListModel) (ListModel sample code for javax.swing.ListModel definition code for javax.swing.ListModel  model)
          Sets the model that represents the contents or "value" of the list and clears the list selection after notifying PropertyChangeListeners.
 void setPrototypeCellValue sample code for javax.swing.JList.setPrototypeCellValue(java.lang.Object) definition code for javax.swing.JList.setPrototypeCellValue(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  prototypeCellValue)
          Computes the fixedCellWidth and fixedCellHeight properties by configuring the cellRenderer to index equals zero for the specified value and then computing the renderer component's preferred size.
 void setSelectedIndex sample code for javax.swing.JList.setSelectedIndex(int) definition code for javax.swing.JList.setSelectedIndex(int) (int index)
          Selects a single cell.
 void setSelectedIndices sample code for javax.swing.JList.setSelectedIndices(int[]) definition code for javax.swing.JList.setSelectedIndices(int[]) (int[] indices)
          Selects a set of cells.
 void setSelectedValue sample code for javax.swing.JList.setSelectedValue(java.lang.Object, boolean) definition code for javax.swing.JList.setSelectedValue(java.lang.Object, boolean) (Object sample code for java.lang.Object definition code for java.lang.Object  anObject, boolean shouldScroll)
          Selects the specified object from the list.
 void setSelectionBackground sample code for javax.swing.JList.setSelectionBackground(java.awt.Color) definition code for javax.swing.JList.setSelectionBackground(java.awt.Color) (Color sample code for java.awt.Color definition code for java.awt.Color  selectionBackground)
          Sets the background color for selected cells.
 void setSelectionForeground sample code for javax.swing.JList.setSelectionForeground(java.awt.Color) definition code for javax.swing.JList.setSelectionForeground(java.awt.Color) (Color sample code for java.awt.Color definition code for java.awt.Color  selectionForeground)
          Sets the foreground color for selected cells.
 void setSelectionInterval sample code for javax.swing.JList.setSelectionInterval(int, int) definition code for javax.swing.JList.setSelectionInterval(int, int) (int anchor, int lead)
          Selects the specified interval.
 void setSelectionMode sample code for javax.swing.JList.setSelectionMode(int) definition code for javax.swing.JList.setSelectionMode(int) (int selectionMode)
          Determines whether single-item or multiple-item selections are allowed.
 void setSelectionModel sample code for javax.swing.JList.setSelectionModel(javax.swing.ListSelectionModel) definition code for javax.swing.JList.setSelectionModel(javax.swing.ListSelectionModel) (ListSelectionModel sample code for javax.swing.ListSelectionModel definition code for javax.swing.ListSelectionModel  selectionModel)
          Sets the selectionModel for the list to a non-null ListSelectionModel implementation.
 void setUI sample code for javax.swing.JList.setUI(javax.swing.plaf.ListUI) definition code for javax.swing.JList.setUI(javax.swing.plaf.ListUI) (ListUI sample code for javax.swing.plaf.ListUI definition code for javax.swing.plaf.ListUI  ui)
          Sets the look and feel (L&F) object that renders this component.
 void setValueIsAdjusting sample code for javax.swing.JList.setValueIsAdjusting(boolean) definition code for javax.swing.JList.setValueIsAdjusting(boolean) (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 setVisibleRowCount sample code for javax.swing.JList.setVisibleRowCount(int) definition code for javax.swing.JList.setVisibleRowCount(int) (int visibleRowCount)
          Sets the preferred number of rows in the list that can be displayed without a scrollbar, as determined by the nearest JViewport ancestor, if any.
 void updateUI sample code for javax.swing.JList.updateUI() definition code for javax.swing.JList.updateUI() ()
          Resets the UI property with the value from the current look and feel.
 
Methods inherited from class javax.swing.JComponent sample code for javax.swing.JComponent definition code for javax.swing.JComponent
addAncestorListener sample code for javax.swing.JComponent.addAncestorListener(javax.swing.event.AncestorListener) definition code for javax.swing.JComponent.addAncestorListener(javax.swing.event.AncestorListener) , addNotify sample code for javax.swing.JComponent.addNotify() definition code for javax.swing.JComponent.addNotify() , addVetoableChangeListener sample code for javax.swing.JComponent.addVetoableChangeListener(java.beans.VetoableChangeListener) definition code for javax.swing.JComponent.addVetoableChangeListener(java.beans.VetoableChangeListener) , computeVisibleRect sample code for javax.swing.JComponent.computeVisibleRect(java.awt.Rectangle) definition code for javax.swing.JComponent.computeVisibleRect(java.awt.Rectangle) , contains sample code for javax.swing.JComponent.contains(int, int) definition code for javax.swing.JComponent.contains(int, int) , createToolTip sample code for javax.swing.JComponent.createToolTip() definition code for javax.swing.JComponent.createToolTip() , disable sample code for javax.swing.JComponent.disable() definition code for javax.swing.JComponent.disable() , enable sample code for javax.swing.JComponent.enable() definition code for javax.swing.JComponent.enable() , firePropertyChange sample code for javax.swing.JComponent.firePropertyChange(java.lang.String, boolean, boolean) definition code for javax.swing.JComponent.firePropertyChange(java.lang.String, boolean, boolean) , firePropertyChange sample code for javax.swing.JComponent.firePropertyChange(java.lang.String, char, char) definition code for javax.swing.JComponent.firePropertyChange(java.lang.String, char, char) , firePropertyChange sample code for javax.swing.JComponent.firePropertyChange(java.lang.String, int, int) definition code for javax.swing.JComponent.firePropertyChange(java.lang.String, int, int) , fireVetoableChange sample code for javax.swing.JComponent.fireVetoableChange(java.lang.String, java.lang.Object, java.lang.Object) definition code for javax.swing.JComponent.fireVetoableChange(java.lang.String, java.lang.Object, java.lang.Object) , getActionForKeyStroke sample code for javax.swing.JComponent.getActionForKeyStroke(javax.swing.KeyStroke) definition code for javax.swing.JComponent.getActionForKeyStroke(javax.swing.KeyStroke) , getActionMap sample code for javax.swing.JComponent.getActionMap() definition code for javax.swing.JComponent.getActionMap() , getAlignmentX sample code for javax.swing.JComponent.getAlignmentX() definition code for javax.swing.JComponent.getAlignmentX() , getAlignmentY sample code for javax.swing.JComponent.getAlignmentY() definition code for javax.swing.JComponent.getAlignmentY() , getAncestorListeners sample code for javax.swing.JComponent.getAncestorListeners() definition code for javax.swing.JComponent.getAncestorListeners() , getAutoscrolls sample code for javax.swing.JComponent.getAutoscrolls() definition code for javax.swing.JComponent.getAutoscrolls() , getBorder sample code for javax.swing.JComponent.getBorder() definition code for javax.swing.JComponent.getBorder() , getBounds sample code for javax.swing.JComponent.getBounds(java.awt.Rectangle) definition code for javax.swing.JComponent.getBounds(java.awt.Rectangle) , getClientProperty sample code for javax.swing.JComponent.getClientProperty(java.lang.Object) definition code for javax.swing.JComponent.getClientProperty(java.lang.Object) , getComponentGraphics sample code for javax.swing.JComponent.getComponentGraphics(java.awt.Graphics) definition code for javax.swing.JComponent.getComponentGraphics(java.awt.Graphics) , getComponentPopupMenu sample code for javax.swing.JComponent.getComponentPopupMenu() definition code for javax.swing.JComponent.getComponentPopupMenu() , getConditionForKeyStroke sample code for javax.swing.JComponent.getConditionForKeyStroke(javax.swing.KeyStroke) definition code for javax.swing.JComponent.getConditionForKeyStroke(javax.swing.KeyStroke) , getDebugGraphicsOptions sample code for javax.swing.JComponent.getDebugGraphicsOptions() definition code for javax.swing.JComponent.getDebugGraphicsOptions() , getDefaultLocale sample code for javax.swing.JComponent.getDefaultLocale() definition code for javax.swing.JComponent.getDefaultLocale() , getFontMetrics sample code for javax.swing.JComponent.getFontMetrics(java.awt.Font) definition code for javax.swing.JComponent.getFontMetrics(java.awt.Font) , getGraphics sample code for javax.swing.JComponent.getGraphics() definition code for javax.swing.JComponent.getGraphics() , getHeight sample code for javax.swing.JComponent.getHeight() definition code for javax.swing.JComponent.getHeight() , getInheritsPopupMenu sample code for javax.swing.JComponent.getInheritsPopupMenu() definition code for javax.swing.JComponent.getInheritsPopupMenu() , getInputMap sample code for javax.swing.JComponent.getInputMap() definition code for javax.swing.JComponent.getInputMap() , getInputMap sample code for javax.swing.JComponent.getInputMap(int) definition code for javax.swing.JComponent.getInputMap(int) , getInputVerifier sample code for javax.swing.JComponent.getInputVerifier() definition code for javax.swing.JComponent.getInputVerifier() , getInsets sample code for javax.swing.JComponent.getInsets() definition code for javax.swing.JComponent.getInsets() , getInsets sample code for javax.swing.JComponent.getInsets(java.awt.Insets) definition code for javax.swing.JComponent.getInsets(java.awt.Insets) , getListeners sample code for javax.swing.JComponent.getListeners(java.lang.Class) definition code for javax.swing.JComponent.getListeners(java.lang.Class) , getLocation sample code for javax.swing.JComponent.getLocation(java.awt.Point) definition code for javax.swing.JComponent.getLocation(java.awt.Point) , getMaximumSize sample code for javax.swing.JComponent.getMaximumSize() definition code for javax.swing.JComponent.getMaximumSize() , getMinimumSize sample code for javax.swing.JComponent.getMinimumSize() definition code for javax.swing.JComponent.getMinimumSize() , getNextFocusableComponent sample code for javax.swing.JComponent.getNextFocusableComponent() definition code for javax.swing.JComponent.getNextFocusableComponent() , getPopupLocation sample code for javax.swing.JComponent.getPopupLocation(java.awt.event.MouseEvent) definition code for javax.swing.JComponent.getPopupLocation(java.awt.event.MouseEvent) , getPreferredSize sample code for javax.swing.JComponent.getPreferredSize() definition code for javax.swing.JComponent.getPreferredSize() , getRegisteredKeyStrokes sample code for javax.swing.JComponent.getRegisteredKeyStrokes() definition code for javax.swing.JComponent.getRegisteredKeyStrokes() , getRootPane sample code for javax.swing.JComponent.getRootPane() definition code for javax.swing.JComponent.getRootPane() , getSize sample code for javax.swing.JComponent.getSize(java.awt.Dimension) definition code for javax.swing.JComponent.getSize(java.awt.Dimension) , getToolTipLocation sample code for javax.swing.JComponent.getToolTipLocation(java.awt.event.MouseEvent) definition code for javax.swing.JComponent.getToolTipLocation(java.awt.event.MouseEvent) , getToolTipText sample code for javax.swing.JComponent.getToolTipText() definition code for javax.swing.JComponent.getToolTipText() , getTopLevelAncestor sample code for javax.swing.JComponent.getTopLevelAncestor() definition code for javax.swing.JComponent.getTopLevelAncestor() , getTransferHandler sample code for javax.swing.JComponent.getTransferHandler() definition code for javax.swing.JComponent.getTransferHandler() , getVerifyInputWhenFocusTarget sample code for javax.swing.JComponent.getVerifyInputWhenFocusTarget() definition code for javax.swing.JComponent.getVerifyInputWhenFocusTarget() , getVetoableChangeListeners sample code for javax.swing.JComponent.getVetoableChangeListeners() definition code for javax.swing.JComponent.getVetoableChangeListeners() , getVisibleRect sample code for javax.swing.JComponent.getVisibleRect() definition code for javax.swing.JComponent.getVisibleRect() , getWidth sample code for javax.swing.JComponent.getWidth() definition code for javax.swing.JComponent.getWidth() , getX sample code for javax.swing.JComponent.getX() definition code for javax.swing.JComponent.getX() , getY sample code for javax.swing.JComponent.getY() definition code for javax.swing.JComponent.getY() , grabFocus sample code for javax.swing.JComponent.grabFocus() definition code for javax.swing.JComponent.grabFocus() , isDoubleBuffered sample code for javax.swing.JComponent.isDoubleBuffered() definition code for javax.swing.JComponent.isDoubleBuffered() , isLightweightComponent sample code for javax.swing.JComponent.isLightweightComponent(java.awt.Component) definition code for javax.swing.JComponent.isLightweightComponent(java.awt.Component) , isManagingFocus sample code for javax.swing.JComponent.isManagingFocus() definition code for javax.swing.JComponent.isManagingFocus() , isOpaque sample code for javax.swing.JComponent.isOpaque() definition code for javax.swing.JComponent.isOpaque() , isOptimizedDrawingEnabled sample code for javax.swing.JComponent.isOptimizedDrawingEnabled() definition code for javax.swing.JComponent.isOptimizedDrawingEnabled() , isPaintingTile sample code for javax.swing.JComponent.isPaintingTile() definition code for javax.swing.JComponent.isPaintingTile() , isRequestFocusEnabled sample code for javax.swing.JComponent.isRequestFocusEnabled() definition code for javax.swing.JComponent.isRequestFocusEnabled() , isValidateRoot sample code for javax.swing.JComponent.isValidateRoot() definition code for javax.swing.JComponent.isValidateRoot() , paint sample code for javax.swing.JComponent.paint(java.awt.Graphics) definition code for javax.swing.JComponent.paint(java.awt.Graphics) , paintBorder sample code for javax.swing.JComponent.paintBorder(java.awt.Graphics) definition code for javax.swing.JComponent.paintBorder(java.awt.Graphics) , paintChildren sample code for javax.swing.JComponent.paintChildren(java.awt.Graphics) definition code for javax.swing.JComponent.paintChildren(java.awt.Graphics) , paintComponent sample code for javax.swing.JComponent.paintComponent(java.awt.Graphics) definition code for javax.swing.JComponent.paintComponent(java.awt.Graphics) , paintImmediately sample code for javax.swing.JComponent.paintImmediately(int, int, int, int) definition code for javax.swing.JComponent.paintImmediately(int, int, int, int) , paintImmediately sample code for javax.swing.JComponent.paintImmediately(java.awt.Rectangle) definition code for javax.swing.JComponent.paintImmediately(java.awt.Rectangle) , print sample code for javax.swing.JComponent.print(java.awt.Graphics) definition code for javax.swing.JComponent.print(java.awt.Graphics) , printAll sample code for javax.swing.JComponent.printAll(java.awt.Graphics) definition code for javax.swing.JComponent.printAll(java.awt.Graphics) , printBorder sample code for javax.swing.JComponent.printBorder(java.awt.Graphics) definition code for javax.swing.JComponent.printBorder(java.awt.Graphics) , printChildren sample code for javax.swing.JComponent.printChildren(java.awt.Graphics) definition code for javax.swing.JComponent.printChildren(java.awt.Graphics) , printComponent sample code for javax.swing.JComponent.printComponent(java.awt.Graphics) definition code for javax.swing.JComponent.printComponent(java.awt.Graphics) , processComponentKeyEvent sample code for javax.swing.JComponent.processComponentKeyEvent(java.awt.event.KeyEvent) definition code for javax.swing.JComponent.processComponentKeyEvent(java.awt.event.KeyEvent) , processKeyBinding sample code for javax.swing.JComponent.processKeyBinding(javax.swing.KeyStroke, java.awt.event.KeyEvent, int, boolean) definition code for javax.swing.JComponent.processKeyBinding(javax.swing.KeyStroke, java.awt.event.KeyEvent, int, boolean) , processKeyEvent sample code for javax.swing.JComponent.processKeyEvent(java.awt.event.KeyEvent) definition code for javax.swing.JComponent.processKeyEvent(java.awt.event.KeyEvent) , processMouseEvent sample code for javax.swing.JComponent.processMouseEvent(java.awt.event.MouseEvent) definition code for javax.swing.JComponent.processMouseEvent(java.awt.event.MouseEvent) , processMouseMotionEvent sample code for javax.swing.JComponent.processMouseMotionEvent(java.awt.event.MouseEvent) definition code for javax.swing.JComponent.processMouseMotionEvent(java.awt.event.MouseEvent) , putClientProperty sample code for javax.swing.JComponent.putClientProperty(java.lang.Object, java.lang.Object) definition code for javax.swing.JComponent.putClientProperty(java.lang.Object, java.lang.Object) , registerKeyboardAction sample code for javax.swing.JComponent.registerKeyboardAction(java.awt.event.ActionListener, javax.swing.KeyStroke, int) definition code for javax.swing.JComponent.registerKeyboardAction(java.awt.event.ActionListener, javax.swing.KeyStroke, int) , registerKeyboardAction sample code for javax.swing.JComponent.registerKeyboardAction(java.awt.event.ActionListener, java.lang.String, javax.swing.KeyStroke, int) definition code for javax.swing.JComponent.registerKeyboardAction(java.awt.event.ActionListener, java.lang.String, javax.swing.KeyStroke, int) , removeAncestorListener sample code for javax.swing.JComponent.removeAncestorListener(javax.swing.event.AncestorListener) definition code for javax.swing.JComponent.removeAncestorListener(javax.swing.event.AncestorListener) , removeNotify sample code for javax.swing.JComponent.removeNotify() definition code for javax.swing.JComponent.removeNotify() , removeVetoableChangeListener sample code for javax.swing.JComponent.removeVetoableChangeListener(java.beans.VetoableChangeListener) definition code for javax.swing.JComponent.removeVetoableChangeListener(java.beans.VetoableChangeListener) , repaint sample code for javax.swing.JComponent.repaint(long, int, int, int, int) definition code for javax.swing.JComponent.repaint(long, int, int, int, int) , repaint sample code for javax.swing.JComponent.repaint(java.awt.Rectangle) definition code for javax.swing.JComponent.repaint(java.awt.Rectangle) , requestDefaultFocus sample code for javax.swing.JComponent.requestDefaultFocus() definition code for javax.swing.JComponent.requestDefaultFocus() , requestFocus sample code for javax.swing.JComponent.requestFocus() definition code for javax.swing.JComponent.requestFocus() , requestFocus sample code for javax.swing.JComponent.requestFocus(boolean) definition code for javax.swing.JComponent.requestFocus(boolean) , requestFocusInWindow sample code for javax.swing.JComponent.requestFocusInWindow() definition code for javax.swing.JComponent.requestFocusInWindow() , requestFocusInWindow sample code for javax.swing.JComponent.requestFocusInWindow(boolean) definition code for javax.swing.JComponent.requestFocusInWindow(boolean) , resetKeyboardActions sample code for javax.swing.JComponent.resetKeyboardActions() definition code for javax.swing.JComponent.resetKeyboardActions() , reshape sample code for javax.swing.JComponent.reshape(int, int, int, int) definition code for javax.swing.JComponent.reshape(int, int, int, int) , revalidate sample code for javax.swing.JComponent.revalidate() definition code for javax.swing.JComponent.revalidate() , scrollRectToVisible sample code for javax.swing.JComponent.scrollRectToVisible(java.awt.Rectangle) definition code for javax.swing.JComponent.scrollRectToVisible(java.awt.Rectangle) , setActionMap sample code for javax.swing.JComponent.setActionMap(javax.swing.ActionMap) definition code for javax.swing.JComponent.setActionMap(javax.swing.ActionMap) , setAlignmentX sample code for javax.swing.JComponent.setAlignmentX(float) definition code for javax.swing.JComponent.setAlignmentX(float) , setAlignmentY sample code for javax.swing.JComponent.setAlignmentY(float) definition code for javax.swing.JComponent.setAlignmentY(float) , setAutoscrolls sample code for javax.swing.JComponent.setAutoscrolls(boolean) definition code for javax.swing.JComponent.setAutoscrolls(boolean) , setBackground sample code for javax.swing.JComponent.setBackground(java.awt.Color) definition code for javax.swing.JComponent.setBackground(java.awt.Color) , setBorder sample code for javax.swing.JComponent.setBorder(javax.swing.border.Border) definition code for javax.swing.JComponent.setBorder(javax.swing.border.Border) , setComponentPopupMenu sample code for javax.swing.JComponent.setComponentPopupMenu(javax.swing.JPopupMenu) definition code for javax.swing.JComponent.setComponentPopupMenu(javax.swing.JPopupMenu) , setDebugGraphicsOptions sample code for javax.swing.JComponent.setDebugGraphicsOptions(int) definition code for javax.swing.JComponent.setDebugGraphicsOptions(int) , setDefaultLocale sample code for javax.swing.JComponent.setDefaultLocale(java.util.Locale) definition code for javax.swing.JComponent.setDefaultLocale(java.util.Locale) , setDoubleBuffered sample code for javax.swing.JComponent.setDoubleBuffered(boolean) definition code for javax.swing.JComponent.setDoubleBuffered(boolean) , setEnabled sample code for javax.swing.JComponent.setEnabled(boolean) definition code for javax.swing.JComponent.setEnabled(boolean) , setFocusTraversalKeys sample code for javax.swing.JComponent.setFocusTraversalKeys(int, java.util.Set) definition code for javax.swing.JComponent.setFocusTraversalKeys(int, java.util.Set) , setFont sample code for javax.swing.JComponent.setFont(java.awt.Font) definition code for javax.swing.JComponent.setFont(java.awt.Font) , setForeground sample code for javax.swing.JComponent.setForeground(java.awt.Color) definition code for javax.swing.JComponent.setForeground(java.awt.Color) , setInheritsPopupMenu sample code for javax.swing.JComponent.setInheritsPopupMenu(boolean) definition code for javax.swing.JComponent.setInheritsPopupMenu(boolean) , setInputMap sample code for javax.swing.JComponent.setInputMap(int, javax.swing.InputMap) definition code for javax.swing.JComponent.setInputMap(int, javax.swing.InputMap) , setInputVerifier sample code for javax.swing.JComponent.setInputVerifier(javax.swing.InputVerifier) definition code for javax.swing.JComponent.setInputVerifier(javax.swing.InputVerifier) , setMaximumSize sample code for javax.swing.JComponent.setMaximumSize(java.awt.Dimension) definition code for javax.swing.JComponent.setMaximumSize(java.awt.Dimension) , setMinimumSize sample code for javax.swing.JComponent.setMinimumSize(java.awt.Dimension) definition code for javax.swing.JComponent.setMinimumSize(java.awt.Dimension) , setNextFocusableComponent sample code for javax.swing.JComponent.setNextFocusableComponent(java.awt.Component) definition code for javax.swing.JComponent.setNextFocusableComponent(java.awt.Component) , setOpaque sample code for javax.swing.JComponent.setOpaque(boolean) definition code for javax.swing.JComponent.setOpaque(boolean) , setPreferredSize sample code for javax.swing.JComponent.setPreferredSize(java.awt.Dimension) definition code for javax.swing.JComponent.setPreferredSize(java.awt.Dimension) , setRequestFocusEnabled sample code for javax.swing.JComponent.setRequestFocusEnabled(boolean) definition code for javax.swing.JComponent.setRequestFocusEnabled(boolean) , setToolTipText sample code for javax.swing.JComponent.setToolTipText(java.lang.String) definition code for javax.swing.JComponent.setToolTipText(java.lang.String) , setTransferHandler sample code for javax.swing.JComponent.setTransferHandler(javax.swing.TransferHandler) definition code for javax.swing.JComponent.setTransferHandler(javax.swing.TransferHandler) , setUI sample code for javax.swing.JComponent.setUI(javax.swing.plaf.ComponentUI) definition code for javax.swing.JComponent.setUI(javax.swing.plaf.ComponentUI) , setVerifyInputWhenFocusTarget sample code for javax.swing.JComponent.setVerifyInputWhenFocusTarget(boolean) definition code for javax.swing.JComponent.setVerifyInputWhenFocusTarget(boolean) , setVisible sample code for javax.swing.JComponent.setVisible(boolean) definition code for javax.swing.JComponent.setVisible(boolean) , unregisterKeyboardAction sample code for javax.swing.JComponent.unregisterKeyboardAction(javax.swing.KeyStroke) definition code for javax.swing.JComponent.unregisterKeyboardAction(javax.swing.KeyStroke) , update sample code for javax.swing.JComponent.update(java.awt.Graphics) definition code for javax.swing.JComponent.update(java.awt.Graphics)
 
Methods inherited from class java.awt.Container sample code for java.awt.Container definition code for java.awt.Container
add sample code for java.awt.Container.add(java.awt.Component) definition code for java.awt.Container.add(java.awt.Component) , add sample code for java.awt.Container.add(java.awt.Component, int) definition code for java.awt.Container.add(java.awt.Component, int) , add sample code for java.awt.Container.add(java.awt.Component, java.lang.Object) definition code for java.awt.Container.add(java.awt.Component, java.lang.Object) , add sample code for java.awt.Container.add(java.awt.Component, java.lang.Object, int) definition code for java.awt.Container.add(java.awt.Component, java.lang.Object, int) , add sample code for java.awt.Container.add(java.lang.String, java.awt.Component) definition code for java.awt.Container.add(java.lang.String, java.awt.Component) , addContainerListener sample code for java.awt.Container.addContainerListener(java.awt.event.ContainerListener) definition code for java.awt.Container.addContainerListener(java.awt.event.ContainerListener) , addImpl sample code for java.awt.Container.addImpl(java.awt.Component, java.lang.Object, int) definition code for java.awt.Container.addImpl(java.awt.Component, java.lang.Object, int) , addPropertyChangeListener sample code for java.awt.Container.addPropertyChangeListener(java.beans.PropertyChangeListener) definition code for java.awt.Container.addPropertyChangeListener(java.beans.PropertyChangeListener) , addPropertyChangeListener sample code for java.awt.Container.addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener) definition code for java.awt.Container.addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener) , applyComponentOrientation sample code for java.awt.Container.applyComponentOrientation(java.awt.ComponentOrientation) definition code for java.awt.Container.applyComponentOrientation(java.awt.ComponentOrientation) , areFocusTraversalKeysSet sample code for java.awt.Container.areFocusTraversalKeysSet(int) definition code for java.awt.Container.areFocusTraversalKeysSet(int) , countComponents sample code for java.awt.Container.countComponents() definition code for java.awt.Container.countComponents() , deliverEvent sample code for java.awt.Container.deliverEvent(java.awt.Event) definition code for java.awt.Container.deliverEvent(java.awt.Event) , doLayout sample code for java.awt.Container.doLayout() definition code for java.awt.Container.doLayout() , findComponentAt sample code for java.awt.Container.findComponentAt(int, int) definition code for java.awt.Container.findComponentAt(int, int) , findComponentAt sample code for java.awt.Container.findComponentAt(java.awt.Point) definition code for java.awt.Container.findComponentAt(java.awt.Point) , getComponent sample code for java.awt.Container.getComponent(int) definition code for java.awt.Container.getComponent(int) , getComponentAt sample code for java.awt.Container.getComponentAt(int, int) definition code for java.awt.Container.getComponentAt(int, int) , getComponentAt sample code for java.awt.Container.getComponentAt(java.awt.Point) definition code for java.awt.Container.getComponentAt(java.awt.Point) , getComponentCount sample code for java.awt.Container.getComponentCount() definition code for java.awt.Container.getComponentCount() , getComponents sample code for java.awt.Container.getComponents() definition code for java.awt.Container.getComponents() , getComponentZOrder sample code for java.awt.Container.getComponentZOrder(java.awt.Component) definition code for java.awt.Container.getComponentZOrder(java.awt.Component) , getContainerListeners sample code for java.awt.Container.getContainerListeners() definition code for java.awt.Container.getContainerListeners() , getFocusTraversalKeys sample code for java.awt.Container.getFocusTraversalKeys(int) definition code for java.awt.Container.getFocusTraversalKeys(int) , getFocusTraversalPolicy sample code for java.awt.Container.getFocusTraversalPolicy() definition code for java.awt.Container.getFocusTraversalPolicy() , getLayout sample code for java.awt.Container.getLayout() definition code for java.awt.Container.getLayout() , getMousePosition sample code for java.awt.Container.getMousePosition(boolean) definition code for java.awt.Container.getMousePosition(boolean) , insets sample code for java.awt.Container.insets() definition code for java.awt.Container.insets() , invalidate sample code for java.awt.Container.invalidate() definition code for java.awt.Container.invalidate() , isAncestorOf sample code for java.awt.Container.isAncestorOf(java.awt.Component) definition code for java.awt.Container.isAncestorOf(java.awt.Component) , isFocusCycleRoot sample code for java.awt.Container.isFocusCycleRoot() definition code for java.awt.Container.isFocusCycleRoot() , isFocusCycleRoot sample code for java.awt.Container.isFocusCycleRoot(java.awt.Container) definition code for java.awt.Container.isFocusCycleRoot(java.awt.Container) , isFocusTraversalPolicyProvider sample code for java.awt.Container.isFocusTraversalPolicyProvider() definition code for java.awt.Container.isFocusTraversalPolicyProvider() , isFocusTraversalPolicySet sample code for java.awt.Container.isFocusTraversalPolicySet() definition code for java.awt.Container.isFocusTraversalPolicySet() , layout sample code for java.awt.Container.layout() definition code for java.awt.Container.layout() , list sample code for java.awt.Container.list(java.io.PrintStream, int) definition code for java.awt.Container.list(java.io.PrintStream, int) , list sample code for java.awt.Container.list(java.io.PrintWriter, int) definition code for java.awt.Container.list(java.io.PrintWriter, int) , locate sample code for java.awt.Container.locate(int, int) definition code for java.awt.Container.locate(int, int) , minimumSize sample code for java.awt.Container.minimumSize() definition code for java.awt.Container.minimumSize() , paintComponents sample code for java.awt.Container.paintComponents(java.awt.Graphics) definition code for java.awt.Container.paintComponents(java.awt.Graphics) , preferredSize sample code for java.awt.Container.preferredSize() definition code for java.awt.Container.preferredSize() , printComponents sample code for java.awt.Container.printComponents(java.awt.Graphics) definition code for java.awt.Container.printComponents(java.awt.Graphics) , processContainerEvent sample code for java.awt.Container.processContainerEvent(java.awt.event.ContainerEvent) definition code for java.awt.Container.processContainerEvent(java.awt.event.ContainerEvent) , processEvent sample code for java.awt.Container.processEvent(java.awt.AWTEvent) definition code for java.awt.Container.processEvent(java.awt.AWTEvent) , remove sample code for java.awt.Container.remove(java.awt.Component) definition code for java.awt.Container.remove(java.awt.Component) , remove sample code for java.awt.Container.remove(int) definition code for java.awt.Container.remove(int) , removeAll sample code for java.awt.Container.removeAll() definition code for java.awt.Container.removeAll() , removeContainerListener sample code for java.awt.Container.removeContainerListener(java.awt.event.ContainerListener) definition code for java.awt.Container.removeContainerListener(java.awt.event.ContainerListener) , setComponentZOrder sample code for java.awt.Container.setComponentZOrder(java.awt.Component, int) definition code for java.awt.Container.setComponentZOrder(java.awt.Component, int) , setFocusCycleRoot sample code for java.awt.Container.setFocusCycleRoot(boolean) definition code for java.awt.Container.setFocusCycleRoot(boolean) , setFocusTraversalPolicy sample code for java.awt.Container.setFocusTraversalPolicy(java.awt.FocusTraversalPolicy) definition code for java.awt.Container.setFocusTraversalPolicy(java.awt.FocusTraversalPolicy) , setFocusTraversalPolicyProvider sample code for java.awt.Container.setFocusTraversalPolicyProvider(boolean) definition code for java.awt.Container.setFocusTraversalPolicyProvider(boolean) , setLayout sample code for java.awt.Container.setLayout(java.awt.LayoutManager) definition code for java.awt.Container.setLayout(java.awt.LayoutManager) , transferFocusBackward sample code for java.awt.Container.transferFocusBackward() definition code for java.awt.Container.transferFocusBackward() , transferFocusDownCycle sample code for java.awt.Container.transferFocusDownCycle() definition code for java.awt.Container.transferFocusDownCycle() , validate sample code for java.awt.Container.validate() definition code for java.awt.Container.validate() , validateTree sample code for java.awt.Container.validateTree() definition code for java.awt.Container.validateTree()
 
Methods inherited from class java.awt.Component sample code for java.awt.Component definition code for java.awt.Component
action sample code for java.awt.Component.action(java.awt.Event, java.lang.Object) definition code for java.awt.Component.action(java.awt.Event, java.lang.Object) , add sample code for java.awt.Component.add(java.awt.PopupMenu) definition code for java.awt.Component.add(java.awt.PopupMenu) , addComponentListener sample code for java.awt.Component.addComponentListener(java.awt.event.ComponentListener) definition code for java.awt.Component.addComponentListener(java.awt.event.ComponentListener) , addFocusListener sample code for java.awt.Component.addFocusListener(java.awt.event.FocusListener) definition code for java.awt.Component.addFocusListener(java.awt.event.FocusListener) , addHierarchyBoundsListener sample code for java.awt.Component.addHierarchyBoundsListener(java.awt.event.HierarchyBoundsListener) definition code for java.awt.Component.addHierarchyBoundsListener(java.awt.event.HierarchyBoundsListener) , addHierarchyListener sample code for java.awt.Component.addHierarchyListener(java.awt.event.HierarchyListener) definition code for java.awt.Component.addHierarchyListener(java.awt.event.HierarchyListener) , addInputMethodListener sample code for java.awt.Component.addInputMethodListener(java.awt.event.InputMethodListener) definition code for java.awt.Component.addInputMethodListener(java.awt.event.InputMethodListener) , addKeyListener sample code for java.awt.Component.addKeyListener(java.awt.event.KeyListener) definition code for java.awt.Component.addKeyListener(java.awt.event.KeyListener) , addMouseListener sample code for java.awt.Component.addMouseListener(java.awt.event.MouseListener) definition code for java.awt.Component.addMouseListener(java.awt.event.MouseListener) , addMouseMotionListener sample code for java.awt.Component.addMouseMotionListener(java.awt.event.MouseMotionListener) definition code for java.awt.Component.addMouseMotionListener(java.awt.event.MouseMotionListener) , addMouseWheelListener sample code for java.awt.Component.addMouseWheelListener(java.awt.event.MouseWheelListener) definition code for java.awt.Component.addMouseWheelListener(java.awt.event.MouseWheelListener) , bounds sample code for java.awt.Component.bounds() definition code for java.awt.Component.bounds() , checkImage sample code for java.awt.Component.checkImage(java.awt.Image, java.awt.image.ImageObserver) definition code for java.awt.Component.checkImage(java.awt.Image, java.awt.image.ImageObserver) , checkImage sample code for java.awt.Component.checkImage(java.awt.Image, int, int, java.awt.image.ImageObserver) definition code for java.awt.Component.checkImage(java.awt.Image, int, int, java.awt.image.ImageObserver) , coalesceEvents sample code for java.awt.Component.coalesceEvents(java.awt.AWTEvent, java.awt.AWTEvent) definition code for java.awt.Component.coalesceEvents(java.awt.AWTEvent, java.awt.AWTEvent) , contains sample code for java.awt.Component.contains(java.awt.Point) definition code for java.awt.Component.contains(java.awt.Point) , createImage sample code for java.awt.Component.createImage(java.awt.image.ImageProducer) definition code for java.awt.Component.createImage(java.awt.image.ImageProducer) , createImage sample code for java.awt.Component.createImage(int, int) definition code for java.awt.Component.createImage(int, int) , createVolatileImage sample code for java.awt.Component.createVolatileImage(int, int) definition code for java.awt.Component.createVolatileImage(int, int) , createVolatileImage sample code for java.awt.Component.createVolatileImage(int, int, java.awt.ImageCapabilities) definition code for java.awt.Component.createVolatileImage(int, int, java.awt.ImageCapabilities) , disableEvents sample code for java.awt.Component.disableEvents(long) definition code for java.awt.Component.disableEvents(long) , dispatchEvent sample code for java.awt.Component.dispatchEvent(java.awt.AWTEvent) definition code for java.awt.Component.dispatchEvent(java.awt.AWTEvent) , enable sample code for java.awt.Component.enable(boolean) definition code for java.awt.Component.enable(boolean) , enableEvents sample code for java.awt.Component.enableEvents(long) definition code for java.awt.Component.enableEvents(long) , enableInputMethods sample code for java.awt.Component.enableInputMethods(boolean) definition code for java.awt.Component.enableInputMethods(boolean) , firePropertyChange sample code for java.awt.Component.firePropertyChange(java.lang.String, byte, byte) definition code for java.awt.Component.firePropertyChange(java.lang.String, byte, byte) , firePropertyChange sample code for java.awt.Component.firePropertyChange(java.lang.String, double, double) definition code for java.awt.Component.firePropertyChange(java.lang.String, double, double) , firePropertyChange sample code for java.awt.Component.firePropertyChange(java.lang.String, float, float) definition code for java.awt.Component.firePropertyChange(java.lang.String, float, float) , firePropertyChange sample code for java.awt.Component.firePropertyChange(java.lang.String, long, long) definition code for java.awt.Component.firePropertyChange(java.lang.String, long, long) , firePropertyChange sample code for java.awt.Component.firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object) definition code for java.awt.Component.firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object) , firePropertyChange sample code for java.awt.Component.firePropertyChange(java.lang.String, short, short) definition code for java.awt.Component.firePropertyChange(java.lang.String, short, short) , getBackground sample code for java.awt.Component.getBackground() definition code for java.awt.Component.getBackground() , getBounds sample code for java.awt.Component.getBounds() definition code for java.awt.Component.getBounds() , getColorModel sample code for java.awt.Component.getColorModel() definition code for java.awt.Component.getColorModel() , getComponentListeners sample code for java.awt.Component.getComponentListeners() definition code for java.awt.Component.getComponentListeners() , getComponentOrientation sample code for java.awt.Component.getComponentOrientation() definition code for java.awt.Component.getComponentOrientation() , getCursor sample code for java.awt.Component.getCursor() definition code for java.awt.Component.getCursor() , getDropTarget sample code for java.awt.Component.getDropTarget() definition code for java.awt.Component.getDropTarget() , getFocusCycleRootAncestor sample code for java.awt.Component.getFocusCycleRootAncestor() definition code for java.awt.Component.getFocusCycleRootAncestor() , getFocusListeners sample code for java.awt.Component.getFocusListeners() definition code for java.awt.Component.getFocusListeners() , getFocusTraversalKeysEnabled sample code for java.awt.Component.getFocusTraversalKeysEnabled() definition code for java.awt.Component.getFocusTraversalKeysEnabled() , getFont sample code for java.awt.Component.getFont() definition code for java.awt.Component.getFont() , getForeground sample code for java.awt.Component.getForeground() definition code for java.awt.Component.getForeground() , getGraphicsConfiguration sample code for java.awt.Component.getGraphicsConfiguration() definition code for java.awt.Component.getGraphicsConfiguration() , getHierarchyBoundsListeners sample code for java.awt.Component.getHierarchyBoundsListeners() definition code for java.awt.Component.getHierarchyBoundsListeners() , getHierarchyListeners sample code for java.awt.Component.getHierarchyListeners() definition code for java.awt.Component.getHierarchyListeners() , getIgnoreRepaint sample code for java.awt.Component.getIgnoreRepaint() definition code for java.awt.Component.getIgnoreRepaint() , getInputContext sample code for java.awt.Component.getInputContext() definition code for java.awt.Component.getInputContext() , getInputMethodListeners sample code for java.awt.Component.getInputMethodListeners() definition code for java.awt.Component.getInputMethodListeners() , getInputMethodRequests sample code for java.awt.Component.getInputMethodRequests() definition code for java.awt.Component.getInputMethodRequests() , getKeyListeners sample code for java.awt.Component.getKeyListeners() definition code for java.awt.Component.getKeyListeners() , getLocale sample code for java.awt.Component.getLocale() definition code for java.awt.Component.getLocale() , getLocation sample code for java.awt.Component.getLocation() definition code for java.awt.Component.getLocation() , getLocationOnScreen sample code for java.awt.Component.getLocationOnScreen() definition code for java.awt.Component.getLocationOnScreen() , getMouseListeners sample code for java.awt.Component.getMouseListeners() definition code for java.awt.Component.getMouseListeners() , getMouseMotionListeners sample code for java.awt.Component.getMouseMotionListeners() definition code for java.awt.Component.getMouseMotionListeners() , getMousePosition sample code for java.awt.Component.getMousePosition() definition code for java.awt.Component.getMousePosition() , getMouseWheelListeners sample code for java.awt.Component.getMouseWheelListeners() definition code for java.awt.Component.getMouseWheelListeners() , getName sample code for java.awt.Component.getName() definition code for java.awt.Component.getName() , getParent sample code for java.awt.Component.getParent() definition code for java.awt.Component.getParent() , getPeer sample code for java.awt.Component.getPeer() definition code for java.awt.Component.getPeer() , getPropertyChangeListeners sample code for java.awt.Component.getPropertyChangeListeners() definition code for java.awt.Component.getPropertyChangeListeners() , getPropertyChangeListeners sample code for java.awt.Component.getPropertyChangeListeners(java.lang.String) definition code for java.awt.Component.getPropertyChangeListeners(java.lang.String) , getSize sample code for java.awt.Component.getSize() definition code for java.awt.Component.getSize() , getToolkit sample code for java.awt.Component.getToolkit() definition code for java.awt.Component.getToolkit() , getTreeLock sample code for java.awt.Component.getTreeLock() definition code for java.awt.Component.getTreeLock() , gotFocus sample code for java.awt.Component.gotFocus(java.awt.Event, java.lang.Object) definition code for java.awt.Component.gotFocus(java.awt.Event, java.lang.Object) , handleEvent sample code for java.awt.Component.handleEvent(java.awt.Event) definition code for java.awt.Component.handleEvent(java.awt.Event) , hasFocus sample code for java.awt.Component.hasFocus() definition code for java.awt.Component.hasFocus() , hide sample code for java.awt.Component.hide() definition code for java.awt.Component.hide() , imageUpdate sample code for java.awt.Component.imageUpdate(java.awt.Image, int, int, int, int, int) definition code for java.awt.Component.imageUpdate(java.awt.Image, int, int, int, int, int) , inside sample code for java.awt.Component.inside(int, int) definition code for java.awt.Component.inside(int, int) , isBackgroundSet sample code for java.awt.Component.isBackgroundSet() definition code for java.awt.Component.isBackgroundSet() , isCursorSet sample code for java.awt.Component.isCursorSet() definition code for java.awt.Component.isCursorSet() , isDisplayable sample code for java.awt.Component.isDisplayable() definition code for java.awt.Component.isDisplayable() , isEnabled sample code for java.awt.Component.isEnabled() definition code for java.awt.Component.isEnabled() , isFocusable sample code for java.awt.Component.isFocusable() definition code for java.awt.Component.isFocusable() , isFocusOwner sample code for java.awt.Component.isFocusOwner() definition code for java.awt.Component.isFocusOwner() , isFocusTraversable sample code for java.awt.Component.isFocusTraversable() definition code for java.awt.Component.isFocusTraversable() , isFontSet sample code for java.awt.Component.isFontSet() definition code for java.awt.Component.isFontSet() , isForegroundSet sample code for java.awt.Component.isForegroundSet() definition code for java.awt.Component.isForegroundSet() , isLightweight sample code for java.awt.Component.isLightweight() definition code for java.awt.Component.isLightweight() , isMaximumSizeSet sample code for java.awt.Component.isMaximumSizeSet() definition code for java.awt.Component.isMaximumSizeSet() , isMinimumSizeSet sample code for java.awt.Component.isMinimumSizeSet() definition code for java.awt.Component.isMinimumSizeSet() , isPreferredSizeSet sample code for java.awt.Component.isPreferredSizeSet() definition code for java.awt.Component.isPreferredSizeSet() , isShowing sample code for java.awt.Component.isShowing() definition code for java.awt.Component.isShowing() , isValid sample code for java.awt.Component.isValid() definition code for java.awt.Component.isValid() , isVisible sample code for java.awt.Component.isVisible() definition code for java.awt.Component.isVisible() , keyDown sample code for java.awt.Component.keyDown(java.awt.Event, int) definition code for java.awt.Component.keyDown(java.awt.Event, int) , keyUp sample code for java.awt.Component.keyUp(java.awt.Event, int) definition code for java.awt.Component.keyUp(java.awt.Event, int) , list sample code for java.awt.Component.list() definition code for java.awt.Component.list() , list sample code for java.awt.Component.list(java.io.PrintStream) definition code for java.awt.Component.list(java.io.PrintStream) , list sample code for java.awt.Component.list(java.io.PrintWriter) definition code for java.awt.Component.list(java.io.PrintWriter) , location sample code for java.awt.Component.location() definition code for java.awt.Component.location() , lostFocus sample code for java.awt.Component.lostFocus(java.awt.Event, java.lang.Object) definition code for java.awt.Component.lostFocus(java.awt.Event, java.lang.Object) , mouseDown sample code for java.awt.Component.mouseDown(java.awt.Event, int, int) definition code for java.awt.Component.mouseDown(java.awt.Event, int, int) , mouseDrag sample code for java.awt.Component.mouseDrag(java.awt.Event, int, int) definition code for java.awt.Component.mouseDrag(java.awt.Event, int, int) , mouseEnter sample code for java.awt.Component.mouseEnter(java.awt.Event, int, int) definition code for java.awt.Component.mouseEnter(java.awt.Event, int, int) , mouseExit sample code for java.awt.Component.mouseExit(java.awt.Event, int, int) definition code for java.awt.Component.mouseExit(java.awt.Event, int, int) , mouseMove sample code for java.awt.Component.mouseMove(java.awt.Event, int, int) definition code for java.awt.Component.mouseMove(java.awt.Event, int, int) , mouseUp sample code for java.awt.Component.mouseUp(java.awt.Event, int, int) definition code for java.awt.Component.mouseUp(java.awt.Event, int, int) , move sample code for java.awt.Component.move(int, int) definition code for java.awt.Component.move(int, int) , nextFocus sample code for java.awt.Component.nextFocus() definition code for java.awt.Component.nextFocus() , paintAll sample code for java.awt.Component.paintAll(java.awt.Graphics) definition code for java.awt.Component.paintAll(java.awt.Graphics) , postEvent sample code for java.awt.Component.postEvent(java.awt.Event) definition code for java.awt.Component.postEvent(java.awt.Event) , prepareImage sample code for java.awt.Component.prepareImage(java.awt.Image, java.awt.image.ImageObserver) definition code for java.awt.Component.prepareImage(java.awt.Image, java.awt.image.ImageObserver) , prepareImage sample code for java.awt.Component.prepareImage(java.awt.Image, int, int, java.awt.image.ImageObserver) definition code for java.awt.Component.prepareImage(java.awt.Image, int, int, java.awt.image.ImageObserver) , processComponentEvent sample code for java.awt.Component.processComponentEvent(java.awt.event.ComponentEvent) definition code for java.awt.Component.processComponentEvent(java.awt.event.ComponentEvent) , processFocusEvent sample code for java.awt.Component.processFocusEvent(java.awt.event.FocusEvent) definition code for java.awt.Component.processFocusEvent(java.awt.event.FocusEvent) , processHierarchyBoundsEvent sample code for java.awt.Component.processHierarchyBoundsEvent(java.awt.event.HierarchyEvent) definition code for java.awt.Component.processHierarchyBoundsEvent(java.awt.event.HierarchyEvent) , processHierarchyEvent sample code for java.awt.Component.processHierarchyEvent(java.awt.event.HierarchyEvent) definition code for java.awt.Component.processHierarchyEvent(java.awt.event.HierarchyEvent) , processInputMethodEvent sample code for java.awt.Component.processInputMethodEvent(java.awt.event.InputMethodEvent) definition code for java.awt.Component.processInputMethodEvent(java.awt.event.InputMethodEvent) , processMouseWheelEvent sample code for java.awt.Component.processMouseWheelEvent(java.awt.event.MouseWheelEvent) definition code for java.awt.Component.processMouseWheelEvent(java.awt.event.MouseWheelEvent) , remove sample code for java.awt.Component.remove(java.awt.MenuComponent) definition code for java.awt.Component.remove(java.awt.MenuComponent) , removeComponentListener sample code for java.awt.Component.removeComponentListener(java.awt.event.ComponentListener) definition code for java.awt.Component.removeComponentListener(java.awt.event.ComponentListener) , removeFocusListener sample code for java.awt.Component.removeFocusListener(java.awt.event.FocusListener) definition code for java.awt.Component.removeFocusListener(java.awt.event.FocusListener) , removeHierarchyBoundsListener sample code for java.awt.Component.removeHierarchyBoundsListener(java.awt.event.HierarchyBoundsListener) definition code for java.awt.Component.removeHierarchyBoundsListener(java.awt.event.HierarchyBoundsListener) , removeHierarchyListener sample code for java.awt.Component.removeHierarchyListener(java.awt.event.HierarchyListener) definition code for java.awt.Component.removeHierarchyListener(java.awt.event.HierarchyListener) , removeInputMethodListener sample code for java.awt.Component.removeInputMethodListener(java.awt.event.InputMethodListener) definition code for java.awt.Component.removeInputMethodListener(java.awt.event.InputMethodListener) , removeKeyListener sample code for java.awt.Component.removeKeyListener(java.awt.event.KeyListener) definition code for java.awt.Component.removeKeyListener(java.awt.event.KeyListener) , removeMouseListener sample code for java.awt.Component.removeMouseListener(java.awt.event.MouseListener) definition code for java.awt.Component.removeMouseListener(java.awt.event.MouseListener) , removeMouseMotionListener sample code for java.awt.Component.removeMouseMotionListener(java.awt.event.MouseMotionListener) definition code for java.awt.Component.removeMouseMotionListener(java.awt.event.MouseMotionListener) , removeMouseWheelListener sample code for java.awt.Component.removeMouseWheelListener(java.awt.event.MouseWheelListener) definition code for java.awt.Component.removeMouseWheelListener(java.awt.event.MouseWheelListener) , removePropertyChangeListener sample code for java.awt.Component.removePropertyChangeListener(java.beans.PropertyChangeListener) definition code for java.awt.Component.removePropertyChangeListener(java.beans.PropertyChangeListener) , removePropertyChangeListener sample code for java.awt.Component.removePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener) definition code for java.awt.Component.removePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener) , repaint sample code for java.awt.Component.repaint() definition code for java.awt.Component.repaint() , repaint sample code for java.awt.Component.repaint(int, int, int, int) definition code for java.awt.Component.repaint(int, int, int, int) , repaint sample code for java.awt.Component.repaint(long) definition code for java.awt.Component.repaint(long) , resize sample code for java.awt.Component.resize(java.awt.Dimension) definition code for java.awt.Component.resize(java.awt.Dimension) , resize sample code for java.awt.Component.resize(int, int) definition code for java.awt.Component.resize(int, int) , setBounds sample code for java.awt.Component.setBounds(int, int, int, int) definition code for java.awt.Component.setBounds(int, int, int, int) , setBounds sample code for java.awt.Component.setBounds(java.awt.Rectangle) definition code for java.awt.Component.setBounds(java.awt.Rectangle) , setComponentOrientation sample code for java.awt.Component.setComponentOrientation(java.awt.ComponentOrientation) definition code for java.awt.Component.setComponentOrientation(java.awt.ComponentOrientation) , setCursor sample code for java.awt.Component.setCursor(java.awt.Cursor) definition code for java.awt.Component.setCursor(java.awt.Cursor) , setDropTarget sample code for java.awt.Component.setDropTarget(java.awt.dnd.DropTarget) definition code for java.awt.Component.setDropTarget(java.awt.dnd.DropTarget) , setFocusable sample code for java.awt.Component.setFocusable(boolean) definition code for java.awt.Component.setFocusable(boolean) , setFocusTraversalKeysEnabled sample code for java.awt.Component.setFocusTraversalKeysEnabled(boolean) definition code for java.awt.Component.setFocusTraversalKeysEnabled(boolean) , setIgnoreRepaint sample code for java.awt.Component.setIgnoreRepaint(boolean) definition code for java.awt.Component.setIgnoreRepaint(boolean) , setLocale sample code for java.awt.Component.setLocale(java.util.Locale) definition code for java.awt.Component.setLocale(java.util.Locale) , setLocation sample code for java.awt.Component.setLocation(int, int) definition code for java.awt.Component.setLocation(int, int) , setLocation sample code for java.awt.Component.setLocation(java.awt.Point) definition code for java.awt.Component.setLocation(java.awt.Point) , setName sample code for java.awt.Component.setName(java.lang.String) definition code for java.awt.Component.setName(java.lang.String) , setSize sample code for java.awt.Component.setSize(java.awt.Dimension) definition code for java.awt.Component.setSize(java.awt.Dimension) , setSize sample code for java.awt.Component.setSize(int, int) definition code for java.awt.Component.setSize(int, int) , show sample code for java.awt.Component.show() definition code for java.awt.Component.show() , show sample code for java.awt.Component.show(boolean) definition code for java.awt.Component.show(boolean) , size sample code for java.awt.Component.size() definition code for java.awt.Component.size() , toString sample code for java.awt.Component.toString() definition code for java.awt.Component.toString() , transferFocus sample code for java.awt.Component.transferFocus() definition code for java.awt.Component.transferFocus() , transferFocusUpCycle sample code for java.awt.Component.transferFocusUpCycle() definition code for java.awt.Component.transferFocusUpCycle()
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Field Detail

VERTICAL sample code for javax.swing.JList.VERTICAL

public static final int VERTICAL
Indicates the default layout: one column of cells.

Since:
1.4
See Also:
setLayoutOrientation(int) sample code for javax.swing.JList.setLayoutOrientation(int) definition code for javax.swing.JList.setLayoutOrientation(int) , Constant Field Values

VERTICAL_WRAP sample code for javax.swing.JList.VERTICAL_WRAP

public static final int VERTICAL_WRAP
Indicates "newspaper style" layout with the cells flowing vertically then horizontally.

Since:
1.4
See Also:
setLayoutOrientation(int) sample code for javax.swing.JList.setLayoutOrientation(int) definition code for javax.swing.JList.setLayoutOrientation(int) , Constant Field Values

HORIZONTAL_WRAP sample code for javax.swing.JList.HORIZONTAL_WRAP

public static final int HORIZONTAL_WRAP
Indicates "newspaper style" with the cells flowing horizontally then vertically.

Since:
1.4
See Also:
setLayoutOrientation(int) sample code for javax.swing.JList.setLayoutOrientation(int) definition code for javax.swing.JList.setLayoutOrientation(int) , Constant Field Values
Constructor Detail

JList sample code for javax.swing.JList(javax.swing.ListModel) definition code for javax.swing.JList(javax.swing.ListModel)

public JList(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. All JList constructors delegate to this one.

Parameters:
dataModel - the data model for this list
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if dataModel is null

JList sample code for javax.swing.JList(java.lang.Object[]) definition code for javax.swing.JList(java.lang.Object[])

public JList(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. This constructor just delegates to the ListModel constructor.

Parameters:
listData - the array of Objects to be loaded into the data model

JList sample code for javax.swing.JList(java.util.Vector<?>) definition code for javax.swing.JList(java.util.Vector<?>)

public JList(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. This constructor just delegates to the ListModel constructor.

Parameters:
listData - the Vector to be loaded into the data model

JList sample code for javax.swing.JList() definition code for javax.swing.JList()

public JList()
Constructs a JList with an empty model.

Method Detail

getUI sample code for javax.swing.JList.getUI() definition code for javax.swing.JList.getUI()

public ListUI sample code for javax.swing.plaf.ListUI definition code for javax.swing.plaf.ListUI  getUI()
Returns the look and feel (L&F) object that renders this component.

Returns:
the ListUI object that renders this component

setUI sample code for javax.swing.JList.setUI(javax.swing.plaf.ListUI) definition code for javax.swing.JList.setUI(javax.swing.plaf.ListUI)

public void setUI(ListUI sample code for javax.swing.plaf.ListUI definition code for javax.swing.plaf.ListUI  ui)
Sets the look and feel (L&F) object that renders this component.

Parameters:
ui - the ListUI L&F object
See Also:
UIDefaults.getUI(javax.swing.JComponent) sample code for javax.swing.UIDefaults.getUI(javax.swing.JComponent) definition code for javax.swing.UIDefaults.getUI(javax.swing.JComponent)

updateUI sample code for javax.swing.JList.updateUI() definition code for javax.swing.JList.updateUI()

public void updateUI()
Resets the UI property with the value from the current look and feel.

Overrides:
updateUI sample code for javax.swing.JComponent.updateUI() definition code for javax.swing.JComponent.updateUI() in class JComponent sample code for javax.swing.JComponent definition code for javax.swing.JComponent
See Also:
UIManager.getUI(javax.swing.JComponent) sample code for javax.swing.UIManager.getUI(javax.swing.JComponent) definition code for javax.swing.UIManager.getUI(javax.swing.JComponent)

getUIClassID sample code for javax.swing.JList.getUIClassID() definition code for javax.swing.JList.getUIClassID()

public String sample code for java.lang.String definition code for java.lang.String  getUIClassID()
Returns the suffix used to construct the name of the look and feel (L&F) class used to render this component.

Overrides:
getUIClassID sample code for javax.swing.JComponent.getUIClassID() definition code for javax.swing.JComponent.getUIClassID() in class JComponent sample code for javax.swing.JComponent definition code for javax.swing.JComponent
Returns:
the string "ListUI"
See Also:
JComponent.getUIClassID() sample code for javax.swing.JComponent.getUIClassID() definition code for javax.swing.JComponent.getUIClassID() , UIDefaults.getUI(javax.swing.JComponent) sample code for javax.swing.UIDefaults.getUI(javax.swing.JComponent) definition code for javax.swing.UIDefaults.getUI(javax.swing.JComponent)

getPrototypeCellValue sample code for javax.swing.JList.getPrototypeCellValue() definition code for javax.swing.JList.getPrototypeCellValue()

public Object sample code for java.lang.Object definition code for java.lang.Object  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.

Returns:
the value of the prototypeCellValue property
See Also:
setPrototypeCellValue(java.lang.Object) sample code for javax.swing.JList.setPrototypeCellValue(java.lang.Object) definition code for javax.swing.JList.setPrototypeCellValue(java.lang.Object)

setPrototypeCellValue sample code for javax.swing.JList.setPrototypeCellValue(java.lang.Object) definition code for javax.swing.JList.setPrototypeCellValue(java.lang.Object)

public void setPrototypeCellValue(Object sample code for java.lang.Object definition code for java.lang.Object  prototypeCellValue)
Computes the fixedCellWidth and fixedCellHeight properties by configuring the cellRenderer to index equals zero for the specified value and then computing the renderer component's preferred size. These properties are useful when the list is too long to allow JList to compute the width/height of each cell and there is a single cell value that is known to occupy as much space as any of the others.

Note that we do set the fixedCellWidth and fixedCellHeight properties here but only a prototypeCellValue PropertyChangeEvent is fired.

To see an example which sets this property, see the class description above.

The default value of this property is null.

This is a JavaBeans bound property.

Parameters:
prototypeCellValue - the value on which to base fixedCellWidth and fixedCellHeight
See Also:
getPrototypeCellValue() sample code for javax.swing.JList.getPrototypeCellValue() definition code for javax.swing.JList.getPrototypeCellValue() , setFixedCellWidth(int) sample code for javax.swing.JList.setFixedCellWidth(int) definition code for javax.swing.JList.setFixedCellWidth(int) , setFixedCellHeight(int) sample code for javax.swing.JList.setFixedCellHeight(int) definition code for javax.swing.JList.setFixedCellHeight(int) , Container.addPropertyChangeListener(java.beans.PropertyChangeListener) sample code for java.awt.Container.addPropertyChangeListener(java.beans.PropertyChangeListener) definition code for java.awt.Container.addPropertyChangeListener(java.beans.PropertyChangeListener)

getFixedCellWidth sample code for javax.swing.JList.getFixedCellWidth() definition code for javax.swing.JList.getFixedCellWidth()

public int getFixedCellWidth()
Returns the fixed cell width value -- the value specified by setting the fixedCellWidth property, rather than that calculated from the list elements.

Returns:
the fixed cell width
See Also:
setFixedCellWidth(int) sample code for javax.swing.JList.setFixedCellWidth(int) definition code for javax.swing.JList.setFixedCellWidth(int)

setFixedCellWidth sample code for javax.swing.JList.setFixedCellWidth(int) definition code for javax.swing.JList.setFixedCellWidth(int)

public void setFixedCellWidth(int width)
Sets the width of every cell in the list. If width is -1, cell widths are computed by applying getPreferredSize to the cellRenderer component for each list element.

The default value of this property is -1.

This is a JavaBeans bound property.

Parameters:
width - the width, in pixels, for all cells in this list
See Also:
getPrototypeCellValue() sample code for javax.swing.JList.getPrototypeCellValue() definition code for javax.swing.JList.getPrototypeCellValue() , setFixedCellWidth(int) sample code for javax.swing.JList.setFixedCellWidth(int) definition code for javax.swing.JList.setFixedCellWidth(int) , Container.addPropertyChangeListener(java.beans.PropertyChangeListener) sample code for java.awt.Container.addPropertyChangeListener(java.beans.PropertyChangeListener) definition code for java.awt.Container.addPropertyChangeListener(java.beans.PropertyChangeListener)

getFixedCellHeight sample code for javax.swing.JList.getFixedCellHeight() definition code for javax.swing.JList.getFixedCellHeight()

public int getFixedCellHeight()
Returns the fixed cell height value -- the value specified by setting the fixedCellHeight property, rather than that calculated from the list elements.

Returns:
the fixed cell height, in pixels
See Also:
setFixedCellHeight(int) sample code for javax.swing.JList.setFixedCellHeight(int) definition code for javax.swing.JList.setFixedCellHeight(int)

setFixedCellHeight sample code for javax.swing.JList.setFixedCellHeight(int) definition code for javax.swing.JList.setFixedCellHeight(int)

public void setFixedCellHeight(int height)
Sets the height of every cell in the list. If height is -1, cell heights are computed by applying getPreferredSize to the cellRenderer component for each list element.

The default value of this property is -1.

This is a JavaBeans bound property.

Parameters:
height - an integer giving the height, in pixels, for all cells in this list
See Also:
getPrototypeCellValue() sample code for javax.swing.JList.getPrototypeCellValue() definition code for javax.swing.JList.getPrototypeCellValue() , setFixedCellWidth(int) sample code for javax.swing.JList.setFixedCellWidth(int) definition code for javax.swing.JList.setFixedCellWidth(int) , Container.addPropertyChangeListener(java.beans.PropertyChangeListener) sample code for java.awt.Container.addPropertyChangeListener(java.beans.PropertyChangeListener) definition code for java.awt.Container.addPropertyChangeListener(java.beans.PropertyChangeListener)

getCellRenderer sample code for javax.swing.JList.getCellRenderer() definition code for javax.swing.JList.getCellRenderer()

public ListCellRenderer sample code for javax.swing.ListCellRenderer definition code for javax.swing.ListCellRenderer  getCellRenderer()
Returns the object that renders the list items.

Returns:
the ListCellRenderer
See Also:
setCellRenderer(javax.swing.ListCellRenderer) sample code for javax.swing.JList.setCellRenderer(javax.swing.ListCellRenderer) definition code for javax.swing.JList.setCellRenderer(javax.swing.ListCellRenderer)

setCellRenderer sample code for javax.swing.JList.setCellRenderer(javax.swing.ListCellRenderer) definition code for javax.swing.JList.setCellRenderer(javax.swing.ListCellRenderer)

public void setCellRenderer(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. If prototypeCellValue was set then the fixedCellWidth and fixedCellHeight properties are set as well. Only one PropertyChangeEvent is generated however - for the cellRenderer property.

The default value of this property is provided by the ListUI delegate, i.e. by the look and feel implementation.

To see an example which sets the cell renderer, see the class description above.

This is a JavaBeans bound property.

Parameters:
cellRenderer - the ListCellRenderer that paints list cells
See Also:
getCellRenderer() sample code for javax.swing.JList.getCellRenderer() definition code for javax.swing.JList.getCellRenderer()

getSelectionForeground sample code for javax.swing.JList.getSelectionForeground() definition code for javax.swing.JList.getSelectionForeground()

public Color sample code for java.awt.Color definition code for java.awt.Color  getSelectionForeground()
Returns the selection foreground color.

Returns:
the Color object for the foreground property
See Also:
setSelectionForeground(java.awt.Color) sample code for javax.swing.JList.setSelectionForeground(java.awt.Color) definition code for javax.swing.JList.setSelectionForeground(java.awt.Color) , setSelectionBackground(java.awt.Color) sample code for javax.swing.JList.setSelectionBackground(java.awt.Color) definition code for javax.swing.JList.setSelectionBackground(java.awt.Color)

setSelectionForeground sample code for javax.swing.JList.setSelectionForeground(java.awt.Color) definition code for javax.swing.JList.setSelectionForeground(java.awt.Color)

public void setSelectionForeground(Color sample code for java.awt.Color definition code for java.awt.Color  selectionForeground)
Sets the foreground color for selected cells. Cell renderers can use this color to render text and graphics for selected cells.

The default value of this property is defined by the look and feel implementation.

This is a JavaBeans bound property.

Parameters:
selectionForeground - the Color to use in the foreground for selected list items
See Also:
getSelectionForeground() sample code for javax.swing.JList.getSelectionForeground() definition code for javax.swing.JList.getSelectionForeground() , setSelectionBackground(java.awt.Color) sample code for javax.swing.JList.setSelectionBackground(java.awt.Color) definition code for javax.swing.JList.setSelectionBackground(java.awt.Color) , JComponent.setForeground(java.awt.Color) sample code for javax.swing.JComponent.setForeground(java.awt.Color) definition code for javax.swing.JComponent.setForeground(java.awt.Color) , JComponent.setBackground(java.awt.Color) sample code for javax.swing.JComponent.setBackground(java.awt.Color) definition code for javax.swing.JComponent.setBackground(java.awt.Color) , JComponent.setFont(java.awt.Font) sample code for javax.swing.JComponent.setFont(java.awt.Font) definition code for javax.swing.JComponent.setFont(java.awt.Font)

getSelectionBackground sample code for javax.swing.JList.getSelectionBackground() definition code for javax.swing.JList.getSelectionBackground()

public Color sample code for java.awt.Color definition code for java.awt.Color  getSelectionBackground()
Returns the background color for selected cells.

Returns:
the Color used for the background of selected list items
See Also:
setSelectionBackground(java.awt.Color) sample code for javax.swing.JList.setSelectionBackground(java.awt.Color) definition code for javax.swing.JList.setSelectionBackground(java.awt.Color) , setSelectionForeground(java.awt.Color) sample code for javax.swing.JList.setSelectionForeground(java.awt.Color) definition code for javax.swing.JList.setSelectionForeground(java.awt.Color)

setSelectionBackground sample code for javax.swing.JList.setSelectionBackground(java.awt.Color) definition code for javax.swing.JList.setSelectionBackground(java.awt.Color)

public void setSelectionBackground(Color sample code for java.awt.Color definition code for java.awt.Color  selectionBackground)
Sets the background color for selected cells. Cell renderers can use this color to the fill selected cells.

The default value of this property is defined by the look and feel implementation.

This is a JavaBeans bound property.

Parameters:
selectionBackground - the Color to use for the background of selected cells
See Also:
getSelectionBackground() sample code for javax.swing.JList.getSelectionBackground() definition code for javax.swing.JList.getSelectionBackground() , setSelectionForeground(java.awt.Color) sample code for javax.swing.JList.setSelectionForeground(java.awt.Color) definition code for javax.swing.JList.setSelectionForeground(java.awt.Color) , JComponent.setForeground(java.awt.Color) sample code for javax.swing.JComponent.setForeground(java.awt.Color) definition code for javax.swing.JComponent.setForeground(java.awt.Color) , JComponent.setBackground(java.awt.Color) sample code for javax.swing.JComponent.setBackground(java.awt.Color) definition code for javax.swing.JComponent.setBackground(java.awt.Color) , JComponent.setFont(java.awt.Font) sample code for javax.swing.JComponent.setFont(java.awt.Font) definition code for javax.swing.JComponent.setFont(java.awt.Font)

getVisibleRowCount sample code for javax.swing.JList.getVisibleRowCount() definition code for javax.swing.JList.getVisibleRowCount()

public int getVisibleRowCount()
Returns the preferred number of visible rows.

Returns:
an integer indicating the preferred number of rows to display without using a scroll bar
See Also:
setVisibleRowCount(int) sample code for javax.swing.JList.setVisibleRowCount(int) definition code for javax.swing.JList.setVisibleRowCount(int)

setVisibleRowCount sample code for javax.swing.JList.setVisibleRowCount(int) definition code for javax.swing.JList.setVisibleRowCount(int)

public void setVisibleRowCount(int visibleRowCount)
Sets the preferred number of rows in the list that can be displayed without a scrollbar, as determined by the nearest JViewport ancestor, if any. The value of this property only affects the value of the JList's preferredScrollableViewportSize.

The default value of this property is 8.

This is a JavaBeans bound property.

Parameters:
visibleRowCount - an integer specifying the preferred number of visible rows
See Also:
getVisibleRowCount() sample code for javax.swing.JList.getVisibleRowCount() definition code for javax.swing.JList.getVisibleRowCount() , JComponent.getVisibleRect() sample code for javax.swing.JComponent.getVisibleRect() definition code for javax.swing.JComponent.getVisibleRect() , JViewport sample code for javax.swing.JViewport definition code for javax.swing.JViewport

getLayoutOrientation sample code for javax.swing.JList.getLayoutOrientation() definition code for javax.swing.JList.getLayoutOrientation()

public int 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.

Returns:
the value of the layoutOrientation property
Since:
1.4
See Also:
setLayoutOrientation(int) sample code for javax.swing.JList.setLayoutOrientation(int) definition code for javax.swing.JList.setLayoutOrientation(int)

setLayoutOrientation sample code for javax.swing.JList.setLayoutOrientation(int) definition code for javax.swing.JList.setLayoutOrientation(int)

public void setLayoutOrientation(int layoutOrientation)
Defines the way list cells are layed out. Consider a JList with four cells, this can be layed out in one of the following ways:
   0
   1
   2
   3
 
   0  1
   2  3
 
   0  2
   1  3
 

These correspond to the following values:

Value

Description

JList.VERTICAL The cells should be layed out vertically in one column.
JList.HORIZONTAL_WRAP The cells should be layed out horizontally, wrapping to a new row as necessary. The number of rows to use will either be defined by getVisibleRowCount if > 0, otherwise the number of rows will be determined by the width of the JList.
JList.VERTICAL_WRAP The cells should be layed out vertically, wrapping to a new column as necessary. The number of rows to use will either be defined by getVisibleRowCount if > 0, otherwise the number of rows will be determined by the height of the JList.
The default value of this property is JList.VERTICAL.

This will throw an IllegalArgumentException if layoutOrientation is not one of JList.HORIZONTAL_WRAP or JList.VERTICAL or JList.VERTICAL_WRAP

Parameters:
layoutOrientation - New orientation, one of JList.HORIZONTAL_WRAP, JList.VERTICAL or JList.VERTICAL_WRAP.
Since:
1.4
See Also:
getLayoutOrientation() sample code for javax.swing.JList.getLayoutOrientation() definition code for javax.swing.JList.getLayoutOrientation() , setVisibleRowCount(int) sample code for javax.swing.JList.setVisibleRowCount(int) definition code for javax.swing.JList.setVisibleRowCount(int) , getScrollableTracksViewportHeight() sample code for javax.swing.JList.getScrollableTracksViewportHeight() definition code for javax.swing.JList.getScrollableTracksViewportHeight()

getFirstVisibleIndex sample code for javax.swing.JList.getFirstVisibleIndex() definition code for javax.swing.JList.getFirstVisibleIndex()

public int getFirstVisibleIndex()
Returns the index of the first visible cell. The cell considered to be "first" depends on the list's componentOrientation property. If the orientation is horizontal left-to-right, then the first visible cell is in the list's upper-left corner. If the orientation is horizontal right-to-left, then the first visible cell is in the list's upper-right corner. If nothing is visible or the list is empty, a -1 is returned. Note that the returned cell may only be partially visible.

Returns:
the index of the first visible cell
See Also:
getLastVisibleIndex() sample code for javax.swing.JList.getLastVisibleIndex() definition code for javax.swing.JList.getLastVisibleIndex() , JComponent.getVisibleRect() sample code for javax.swing.JComponent.getVisibleRect() definition code for javax.swing.JComponent.getVisibleRect()

getLastVisibleIndex sample code for javax.swing.JList.getLastVisibleIndex() definition code for javax.swing.JList.getLastVisibleIndex()

public int getLastVisibleIndex()
Returns the index of the last visible cell. The cell considered to be "last" depends on the list's componentOrientation property. If the orientation is horizontal left-to-right, then the last visible cell is in the JList's lower-right corner. If the orientation is horizontal right-to-left, then the last visible cell is in the JList's lower-left corner. If nothing is visible or the list is empty, a -1 is returned. Note that the returned cell may only be partially visible.

Returns:
the index of the last visible cell
See Also:
getFirstVisibleIndex() sample code for javax.swing.JList.getFirstVisibleIndex() definition code for javax.swing.JList.getFirstVisibleIndex() , JComponent.getVisibleRect() sample code for javax.swing.JComponent.getVisibleRect() definition code for javax.swing.JComponent.getVisibleRect()

ensureIndexIsVisible sample code for javax.swing.JList.ensureIndexIsVisible(int) definition code for javax.swing.JList.ensureIndexIsVisible(int)

public void ensureIndexIsVisible(int index)
Scrolls the viewport to make the specified cell completely visible. Note, for this method to work, the JList must be displayed within a JViewport.

Parameters:
index - the index of the cell to make visible
See Also:
JComponent.scrollRectToVisible(java.awt.Rectangle) sample code for javax.swing.JComponent.scrollRectToVisible(java.awt.Rectangle) definition code for javax.swing.JComponent.scrollRectToVisible(java.awt.Rectangle) , JComponent.getVisibleRect() sample code for javax.swing.JComponent.getVisibleRect() definition code for javax.swing.JComponent.getVisibleRect()

setDragEnabled sample code for javax.swing.JList.setDragEnabled(boolean) definition code for javax.swing.JList.setDragEnabled(boolean)

public void setDragEnabled(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. The transferHandler property needs to be set to a non-null value for the drag to do anything. The default value of the dragEnabled property is false.

When automatic drag handling is enabled, most look and feels begin a drag-and-drop operation whenever the user presses the mouse button over a selection and then moves the mouse a few pixels. Setting this property to true can therefore have a subtle effect on how selections behave.

Some look and feels might not support automatic drag and drop; they will ignore this property. You can work around such look and feels by modifying the component to directly call the exportAsDrag method of a TransferHandler.

Parameters:
b - the value to set the dragEnabled property to
Throws:
HeadlessException sample code for java.awt.HeadlessException definition code for java.awt.HeadlessException - if b is true and GraphicsEnvironment.isHeadless() returns true
Since:
1.4
See Also:
GraphicsEnvironment.isHeadless() sample code for java.awt.GraphicsEnvironment.isHeadless() definition code for java.awt.GraphicsEnvironment.isHeadless() , getDragEnabled() sample code for javax.swing.JList.getDragEnabled() definition code for javax.swing.JList.getDragEnabled() , JComponent.setTransferHandler(javax.swing.TransferHandler) sample code for javax.swing.JComponent.setTransferHandler(javax.swing.TransferHandler) definition code for javax.swing.JComponent.setTransferHandler(javax.swing.TransferHandler) , TransferHandler sample code for javax.swing.TransferHandler definition code for javax.swing.TransferHandler

getDragEnabled sample code for javax.swing.JList.getDragEnabled() definition code for javax.swing.JList.getDragEnabled()

public boolean getDragEnabled()
Gets the dragEnabled property.

Returns:
the value of the dragEnabled property
Since:
1.4
See Also:
setDragEnabled(boolean) sample code for javax.swing.JList.setDragEnabled(boolean) definition code for javax.swing.JList.setDragEnabled(boolean)

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)

public int getNextMatch(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.

Parameters:
prefix - the string to test for a match
startIndex - the index for starting the search
bias - the search direction, either Position.Bias.Forward or Position.Bias.Backward.
Returns:
the index of the next list element that starts with the prefix; otherwise -1
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if prefix is null or startIndex is out of bounds
Since:
1.4

getToolTipText sample code for javax.swing.JList.getToolTipText(java.awt.event.MouseEvent) definition code for javax.swing.JList.getToolTipText(java.awt.event.MouseEvent)

public String sample code for java.lang.String definition code for java.lang.String  getToolTipText(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.

Note: For JList to properly display tooltips of its renderers JList must be a registered component with the ToolTipManager. This is done automatically in the constructor, but if at a later point JList is told setToolTipText(null) it will unregister the list component, and no tips from renderers will display anymore.

Overrides:
getToolTipText sample code for javax.swing.JComponent.getToolTipText(java.awt.event.MouseEvent) definition code for javax.swing.JComponent.getToolTipText(java.awt.event.MouseEvent) in class JComponent sample code for javax.swing.JComponent definition code for javax.swing.JComponent
See Also:
JComponent.getToolTipText() sample code for javax.swing.JComponent.getToolTipText() definition code for javax.swing.JComponent.getToolTipText()

locationToIndex sample code for javax.swing.JList.locationToIndex(java.awt.Point) definition code for javax.swing.JList.locationToIndex(java.awt.Point)

public int locationToIndex(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. To determine if the cell actually contains the specified location use a combination of this method and getCellBounds. Returns -1 if the model is empty.

Parameters:
location - the coordinates of the cell, relative to JList
Returns:
an integer -- the index of the cell at the given location, or -1.

indexToLocation sample code for javax.swing.JList.indexToLocation(int) definition code for javax.swing.JList.indexToLocation(int)

public Point sample code for java.awt.Point definition code for java.awt.Point  indexToLocation(int index)
Returns the origin of the specified item in JList coordinates. Returns null if index isn't valid.

Parameters:
index - the index of the JList cell
Returns:
the origin of the index'th cell

getCellBounds sample code for javax.swing.JList.getCellBounds(int, int) definition code for javax.swing.JList.getCellBounds(int, int)

public Rectangle sample code for java.awt.Rectangle definition code for java.awt.Rectangle  getCellBounds(int index0,
                               int index1)
Returns the bounds of the specified range of items in JList coordinates. Returns null if index isn't valid.

Parameters:
index0 - the index of the first JList cell in the range
index1 - the index of the last JList cell in the range
Returns:
the bounds of the indexed cells in pixels

getModel sample code for javax.swing.JList.getModel() definition code for javax.swing.JList.getModel()

public ListModel sample code for javax.swing.ListModel definition code for javax.swing.ListModel  getModel()
Returns the data model that holds the list of items displayed by the JList component.

Returns:
the ListModel that provides the displayed list of items
See Also:
setModel(javax.swing.ListModel) sample code for javax.swing.JList.setModel(javax.swing.ListModel) definition code for javax.swing.JList.setModel(javax.swing.ListModel)

setModel sample code for javax.swing.JList.setModel(javax.swing.ListModel) definition code for javax.swing.JList.setModel(javax.swing.ListModel)

public void setModel(ListModel sample code for javax.swing.ListModel definition code for javax.swing.ListModel  model)
Sets the model that represents the contents or "value" of the list and clears the list selection after notifying PropertyChangeListeners.

This is a JavaBeans bound property.

Parameters:
model - the ListModel that provides the list of items for display
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if model is null
See Also:
getModel() sample code for javax.swing.JList.getModel() definition code for javax.swing.JList.getModel()

setListData sample code for javax.swing.JList.setListData(java.lang.Object[]) definition code for javax.swing.JList.setListData(java.lang.Object[])

public void setListData(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.

Parameters:
listData - an array of Objects containing the items to display in the list
See Also:
setModel(javax.swing.ListModel) sample code for javax.swing.JList.setModel(javax.swing.ListModel) definition code for javax.swing.JList.setModel(javax.swing.ListModel)

setListData sample code for javax.swing.JList.setListData(java.util.Vector<?>) definition code for javax.swing.JList.setListData(java.util.Vector<?>)

public void setListData(Vector sample code for java.util.Vector definition code for java.util.Vector <?> listData)
Constructs a ListModel from a Vector and then applies setModel to it.

Parameters:
listData - a Vector containing the items to display in the list
See Also:
setModel(javax.swing.ListModel) sample code for javax.swing.JList.setModel(javax.swing.ListModel) definition code for javax.swing.JList.setModel(javax.swing.ListModel)

createSelectionModel sample code for javax.swing.JList.createSelectionModel() definition code for javax.swing.JList.createSelectionModel()

protected ListSelectionModel sample code for javax.swing.ListSelectionModel definition code for 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 JList.
See Also:
setSelectionModel(javax.swing.ListSelectionModel) sample code for javax.swing.JList.setSelectionModel(javax.swing.ListSelectionModel) definition code for javax.swing.JList.setSelectionModel(javax.swing.ListSelectionModel) , DefaultListSelectionModel sample code for javax.swing.DefaultListSelectionModel definition code for javax.swing.DefaultListSelectionModel

getSelectionModel sample code for javax.swing.JList.getSelectionModel() definition code for javax.swing.JList.getSelectionModel()

public ListSelectionModel sample code for javax.swing.ListSelectionModel definition code for 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) sample code for javax.swing.JList.setSelectionModel(javax.swing.ListSelectionModel) definition code for javax.swing.JList.setSelectionModel(javax.swing.ListSelectionModel) , ListSelectionModel sample code for javax.swing.ListSelectionModel definition code for javax.swing.ListSelectionModel

fireSelectionValueChanged sample code for javax.swing.JList.fireSelectionValueChanged(int, int, boolean) definition code for javax.swing.JList.fireSelectionValueChanged(int, int, boolean)

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 index
lastIndex - the last selected index
isAdjusting - true if multiple changes are being made
See Also:
addListSelectionListener(javax.swing.event.ListSelectionListener) sample code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener) , removeListSelectionListener(javax.swing.event.ListSelectionListener) sample code for javax.swing.JList.removeListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.JList.removeListSelectionListener(javax.swing.event.ListSelectionListener) , EventListenerList sample code for javax.swing.event.EventListenerList definition code for javax.swing.event.EventListenerList

addListSelectionListener sample code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener)

public void addListSelectionListener(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. Listeners added directly to the JList will have their ListSelectionEvent.getSource() == this JList (instead of the ListSelectionModel).

Parameters:
listener - the ListSelectionListener to add
See Also:
getSelectionModel() sample code for javax.swing.JList.getSelectionModel() definition code for javax.swing.JList.getSelectionModel() , getListSelectionListeners() sample code for javax.swing.JList.getListSelectionListeners() definition code for javax.swing.JList.getListSelectionListeners()

removeListSelectionListener sample code for javax.swing.JList.removeListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.JList.removeListSelectionListener(javax.swing.event.ListSelectionListener)

public void removeListSelectionListener(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.

Parameters:
listener - the ListSelectionListener to remove
See Also:
addListSelectionListener(javax.swing.event.ListSelectionListener) sample code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener) , getSelectionModel() sample code for javax.swing.JList.getSelectionModel() definition code for javax.swing.JList.getSelectionModel()

getListSelectionListeners sample code for javax.swing.JList.getListSelectionListeners() definition code for javax.swing.JList.getListSelectionListeners()

public ListSelectionListener sample code for javax.swing.event.ListSelectionListener definition code for 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
Since:
1.4
See Also:
addListSelectionListener(javax.swing.event.ListSelectionListener) sample code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener)

setSelectionModel sample code for javax.swing.JList.setSelectionModel(javax.swing.ListSelectionModel) definition code for javax.swing.JList.setSelectionModel(javax.swing.ListSelectionModel)

public void setSelectionModel(ListSelectionModel sample code for javax.swing.ListSelectionModel definition code for javax.swing.ListSelectionModel  selectionModel)
Sets the selectionModel for the list to a non-null ListSelectionModel implementation. The selection model handles the task of making single selections, selections of contiguous ranges, and non-contiguous selections.

This is a JavaBeans bound property.

Parameters:
selectionModel - the ListSelectionModel that implements the selections
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if selectionModel is null
See Also:
getSelectionModel() sample code for javax.swing.JList.getSelectionModel() definition code for javax.swing.JList.getSelectionModel()

setSelectionMode sample code for javax.swing.JList.setSelectionMode(int) definition code for javax.swing.JList.setSelectionMode(int)

public void setSelectionMode(int selectionMode)
Determines whether single-item or multiple-item selections are allowed. The following selectionMode values are allowed:

Parameters:
selectionMode - an integer specifying the type of selections that are permissible
See Also:
getSelectionMode() sample code for javax.swing.JList.getSelectionMode() definition code for javax.swing.JList.getSelectionMode()

getSelectionMode sample code for javax.swing.JList.getSelectionMode() definition code for javax.swing.JList.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) sample code for javax.swing.JList.setSelectionMode(int) definition code for javax.swing.JList.setSelectionMode(int)

getAnchorSelectionIndex sample code for javax.swing.JList.getAnchorSelectionIndex() definition code for javax.swing.JList.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() sample code for javax.swing.ListSelectionModel.getAnchorSelectionIndex() definition code for javax.swing.ListSelectionModel.getAnchorSelectionIndex() , addSelectionInterval(int, int) sample code for javax.swing.JList.addSelectionInterval(int, int) definition code for javax.swing.JList.addSelectionInterval(int, int) , setSelectionInterval(int, int) sample code for javax.swing.JList.setSelectionInterval(int, int) definition code for javax.swing.JList.setSelectionInterval(int, int) , addListSelectionListener(javax.swing.event.ListSelectionListener) sample code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener)

getLeadSelectionIndex sample code for javax.swing.JList.getLeadSelectionIndex() definition code for javax.swing.JList.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() sample code for javax.swing.ListSelectionModel.getLeadSelectionIndex() definition code for javax.swing.ListSelectionModel.getLeadSelectionIndex() , addSelectionInterval(int, int) sample code for javax.swing.JList.addSelectionInterval(int, int) definition code for javax.swing.JList.addSelectionInterval(int, int) , setSelectionInterval(int, int) sample code for javax.swing.JList.setSelectionInterval(int, int) definition code for javax.swing.JList.setSelectionInterval(int, int) , addListSelectionListener(javax.swing.event.ListSelectionListener) sample code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener)

getMinSelectionIndex sample code for javax.swing.JList.getMinSelectionIndex() definition code for javax.swing.JList.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() sample code for javax.swing.ListSelectionModel.getMinSelectionIndex() definition code for javax.swing.ListSelectionModel.getMinSelectionIndex() , addListSelectionListener(javax.swing.event.ListSelectionListener) sample code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener)

getMaxSelectionIndex sample code for javax.swing.JList.getMaxSelectionIndex() definition code for javax.swing.JList.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() sample code for javax.swing.ListSelectionModel.getMaxSelectionIndex() definition code for javax.swing.ListSelectionModel.getMaxSelectionIndex() , addListSelectionListener(javax.swing.event.ListSelectionListener) sample code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener)

isSelectedIndex sample code for javax.swing.JList.isSelectedIndex(int) definition code for javax.swing.JList.isSelectedIndex(int)

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) sample code for javax.swing.ListSelectionModel.isSelectedIndex(int) definition code for javax.swing.ListSelectionModel.isSelectedIndex(int) , setSelectedIndex(int) sample code for javax.swing.JList.setSelectedIndex(int) definition code for javax.swing.JList.setSelectedIndex(int) , addListSelectionListener(javax.swing.event.ListSelectionListener) sample code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener)

isSelectionEmpty sample code for javax.swing.JList.isSelectionEmpty() definition code for javax.swing.JList.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() sample code for javax.swing.ListSelectionModel.isSelectionEmpty() definition code for javax.swing.ListSelectionModel.isSelectionEmpty() , clearSelection() sample code for javax.swing.JList.clearSelection() definition code for javax.swing.JList.clearSelection() , addListSelectionListener(javax.swing.event.ListSelectionListener) sample code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener)

clearSelection sample code for javax.swing.JList.clearSelection() definition code for javax.swing.JList.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() sample code for javax.swing.ListSelectionModel.clearSelection() definition code for javax.swing.ListSelectionModel.clearSelection() , isSelectionEmpty() sample code for javax.swing.JList.isSelectionEmpty() definition code for javax.swing.JList.isSelectionEmpty() , addListSelectionListener(javax.swing.event.ListSelectionListener) sample code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener)

setSelectionInterval sample code for javax.swing.JList.setSelectionInterval(int, int) definition code for javax.swing.JList.setSelectionInterval(int, int)

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 select
lead - the last index to select
Throws:
IndexOutOfBoundsException sample code for java.lang.IndexOutOfBoundsException definition code for java.lang.IndexOutOfBoundsException - if either anchor or lead are less than -1
See Also:
ListSelectionModel.setSelectionInterval(int, int) sample code for javax.swing.ListSelectionModel.setSelectionInterval(int, int) definition code for javax.swing.ListSelectionModel.setSelectionInterval(int, int) , addSelectionInterval(int, int) sample code for javax.swing.JList.addSelectionInterval(int, int) definition code for javax.swing.JList.addSelectionInterval(int, int) , removeSelectionInterval(int, int) sample code for javax.swing.JList.removeSelectionInterval(int, int) definition code for javax.swing.JList.removeSelectionInterval(int, int) , addListSelectionListener(javax.swing.event.ListSelectionListener) sample code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener)

addSelectionInterval sample code for javax.swing.JList.addSelectionInterval(int, int) definition code for javax.swing.JList.addSelectionInterval(int, int)

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 selection
lead - the last index to add to the selection
Throws:
IndexOutOfBoundsException sample code for java.lang.IndexOutOfBoundsException definition code for java.lang.IndexOutOfBoundsException - if either anchor or lead are less than -1
See Also:
ListSelectionModel.addSelectionInterval(int, int) sample code for javax.swing.ListSelectionModel.addSelectionInterval(int, int) definition code for javax.swing.ListSelectionModel.addSelectionInterval(int, int) , setSelectionInterval(int, int) sample code for javax.swing.JList.setSelectionInterval(int, int) definition code for javax.swing.JList.setSelectionInterval(int, int) , removeSelectionInterval(int, int) sample code for javax.swing.JList.removeSelectionInterval(int, int) definition code for javax.swing.JList.removeSelectionInterval(int, int) , addListSelectionListener(javax.swing.event.ListSelectionListener) sample code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener)

removeSelectionInterval sample code for javax.swing.JList.removeSelectionInterval(int, int) definition code for javax.swing.JList.removeSelectionInterval(int, int)

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 selection
index1 - the last index to remove from the selection
Throws:
IndexOutOfBoundsException sample code for java.lang.IndexOutOfBoundsException definition code for java.lang.IndexOutOfBoundsException - if either index0 or index1 are less than -1
See Also:
ListSelectionModel.removeSelectionInterval(int, int) sample code for javax.swing.ListSelectionModel.removeSelectionInterval(int, int) definition code for javax.swing.ListSelectionModel.removeSelectionInterval(int, int) , setSelectionInterval(int, int) sample code for javax.swing.JList.setSelectionInterval(int, int) definition code for javax.swing.JList.setSelectionInterval(int, int) , addSelectionInterval(int, int) sample code for javax.swing.JList.addSelectionInterval(int, int) definition code for javax.swing.JList.addSelectionInterval(int, int) , addListSelectionListener(javax.swing.event.ListSelectionListener) sample code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener)

setValueIsAdjusting sample code for javax.swing.JList.setValueIsAdjusting(boolean) definition code for javax.swing.JList.setValueIsAdjusting(boolean)

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) sample code for javax.swing.ListSelectionModel.setValueIsAdjusting(boolean) definition code for javax.swing.ListSelectionModel.setValueIsAdjusting(boolean)

getValueIsAdjusting sample code for javax.swing.JList.getValueIsAdjusting() definition code for javax.swing.JList.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() sample code for javax.swing.ListSelectionModel.getValueIsAdjusting() definition code for javax.swing.ListSelectionModel.getValueIsAdjusting()

getSelectedIndices sample code for javax.swing.JList.getSelectedIndices() definition code for javax.swing.JList.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) sample code for javax.swing.JList.removeSelectionInterval(int, int) definition code for javax.swing.JList.removeSelectionInterval(int, int) , addListSelectionListener(javax.swing.event.ListSelectionListener) sample code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener)

setSelectedIndex sample code for javax.swing.JList.setSelectedIndex(int) definition code for javax.swing.JList.setSelectedIndex(int)

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) sample code for javax.swing.ListSelectionModel.setSelectionInterval(int, int) definition code for javax.swing.ListSelectionModel.setSelectionInterval(int, int) , isSelectedIndex(int) sample code for javax.swing.JList.isSelectedIndex(int) definition code for javax.swing.JList.isSelectedIndex(int) , addListSelectionListener(javax.swing.event.ListSelectionListener) sample code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener)

setSelectedIndices sample code for javax.swing.JList.setSelectedIndices(int[]) definition code for javax.swing.JList.setSelectedIndices(int[])

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) sample code for javax.swing.ListSelectionModel.addSelectionInterval(int, int) definition code for javax.swing.ListSelectionModel.addSelectionInterval(int, int) , isSelectedIndex(int) sample code for javax.swing.JList.isSelectedIndex(int) definition code for javax.swing.JList.isSelectedIndex(int) , addListSelectionListener(javax.swing.event.ListSelectionListener) sample code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener)

getSelectedValues sample code for javax.swing.JList.getSelectedValues() definition code for javax.swing.JList.getSelectedValues()

public Object sample code for java.lang.Object definition code for 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) sample code for javax.swing.JList.isSelectedIndex(int) definition code for javax.swing.JList.isSelectedIndex(int) , getModel() sample code for javax.swing.JList.getModel() definition code for javax.swing.JList.getModel() , addListSelectionListener(javax.swing.event.ListSelectionListener) sample code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener)

getSelectedIndex sample code for javax.swing.JList.getSelectedIndex() definition code for javax.swing.JList.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() sample code for javax.swing.JList.getMinSelectionIndex() definition code for javax.swing.JList.getMinSelectionIndex() , addListSelectionListener(javax.swing.event.ListSelectionListener) sample code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener)

getSelectedValue sample code for javax.swing.JList.getSelectedValue() definition code for javax.swing.JList.getSelectedValue()

public Object sample code for java.lang.Object definition code for java.lang.Object  getSelectedValue()
Returns the first selected value, or null if the selection is empty.

Returns:
the first selected value
See Also:
getMinSelectionIndex() sample code for javax.swing.JList.getMinSelectionIndex() definition code for javax.swing.JList.getMinSelectionIndex() , getModel() sample code for javax.swing.JList.getModel() definition code for javax.swing.JList.getModel() , addListSelectionListener(javax.swing.event.ListSelectionListener) sample code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener) definition code for javax.swing.JList.addListSelectionListener(javax.swing.event.ListSelectionListener)

setSelectedValue sample code for javax.swing.JList.setSelectedValue(java.lang.Object, boolean) definition code for javax.swing.JList.setSelectedValue(java.lang.Object, boolean)

public void setSelectedValue(Object sample code for java.lang.Object definition code for java.lang.Object  anObject,
                             boolean shouldScroll)
Selects the specified object from the list.

Parameters:
anObject - the object to select
shouldScroll - true if the list should scroll to display the selected object, if one exists; otherwise false

getPreferredScrollableViewportSize sample code for javax.swing.JList.getPreferredScrollableViewportSize() definition code for javax.swing.JList.getPreferredScrollableViewportSize()

public Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension  getPreferredScrollableViewportSize()
Computes the size of the viewport needed to display visibleRowCount rows. This is trivial if fixedCellWidth and fixedCellHeight were specified. Note that they can be specified implicitly with the prototypeCellValue property. If fixedCellWidth wasn't specified, it's computed by finding the widest list element. If fixedCellHeight wasn't specified then we resort to heuristics: If the layout orientation is not VERTICAL, than this will return the value from getPreferredSize. The current ListUI is expected to override getPreferredSize to return an appropriate value.

Specified by:
getPreferredScrollableViewportSize sample code for javax.swing.Scrollable.getPreferredScrollableViewportSize() definition code for javax.swing.Scrollable.getPreferredScrollableViewportSize() in interface Scrollable sample code for javax.swing.Scrollable definition code for javax.swing.Scrollable
Returns:
a dimension containing the size of the viewport needed to display visibleRowCount rows
See Also:
getPreferredScrollableViewportSize() sample code for javax.swing.JList.getPreferredScrollableViewportSize() definition code for javax.swing.JList.getPreferredScrollableViewportSize() , setPrototypeCellValue(java.lang.Object) sample code for javax.swing.JList.setPrototypeCellValue(java.lang.Object) definition code for javax.swing.JList.setPrototypeCellValue(java.lang.Object)

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)

public int getScrollableUnitIncrement(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).

For horizontal scrolling if the list is layed out vertically (the orientation is VERTICAL) than the lists font size or 1 is returned if the font is null is used.

Note that the value of visibleRect must be the equal to this.getVisibleRect().

Specified by:
getScrollableUnitIncrement sample code for javax.swing.Scrollable.getScrollableUnitIncrement(java.awt.Rectangle, int, int) definition code for javax.swing.Scrollable.getScrollableUnitIncrement(java.awt.Rectangle, int, int) in interface Scrollable sample code for javax.swing.Scrollable definition code for javax.swing.Scrollable
Parameters:
visibleRect - the visible rectangle
orientation - HORIZONTAL or VERTICAL
direction - if <= 0, then scroll UP; if > 0, then scroll DOWN
Returns:
the distance, in pixels, to scroll to expose the next or previous unit
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if visibleRect is null, or orientation isn't one of SwingConstants.VERTICAL, SwingConstants.HORIZONTAL.
See Also:
Scrollable.getScrollableUnitIncrement(java.awt.Rectangle, int, int) sample code for javax.swing.Scrollable.getScrollableUnitIncrement(java.awt.Rectangle, int, int) definition code for javax.swing.Scrollable.getScrollableUnitIncrement(java.awt.Rectangle, int, 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)

public int getScrollableBlockIncrement(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. For vertical scrolling we are using the follows rules:
  • if scrolling down (direction is greater than 0), the last visible element should become the first completely visible element
  • if scrolling up, the first visible element should become the last completely visible element
  • visibleRect.height if the list is empty

For horizontal scrolling if the list is layed out horizontally (the orientation is VERTICAL_WRAP or HORIZONTAL_WRAP):

  • if scrolling right (direction is greater than 0), the last visible element should become the first completely visible element
  • if scrolling left, the first visible element should become the last completely visible element
  • visibleRect.width if the list is empty

    Return visibleRect.width if the list is layed out vertically.

    Note that the value of visibleRect must be the equal to this.getVisibleRect().

    Specified by:
    getScrollableBlockIncrement sample code for javax.swing.Scrollable.getScrollableBlockIncrement(java.awt.Rectangle, int, int) definition code for javax.swing.Scrollable.getScrollableBlockIncrement(java.awt.Rectangle, int, int) in interface Scrollable sample code for javax.swing.Scrollable definition code for javax.swing.Scrollable
    Parameters:
    visibleRect - the visible rectangle
    orientation - HORIZONTAL or VERTICAL
    direction - if <= 0, then scroll UP; if > 0, then scroll DOWN
    Returns:
    the block increment amount.
    Throws:
    IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if visibleRect is null, or orientation isn't one of SwingConstants.VERTICAL, SwingConstants.HORIZONTAL.
    See Also:
    Scrollable.getScrollableUnitIncrement(java.awt.Rectangle, int, int) sample code for javax.swing.Scrollable.getScrollableUnitIncrement(java.awt.Rectangle, int, int) definition code for javax.swing.Scrollable.getScrollableUnitIncrement(java.awt.Rectangle, int, int)

  • getScrollableTracksViewportWidth sample code for javax.swing.JList.getScrollableTracksViewportWidth() definition code for javax.swing.JList.getScrollableTracksViewportWidth()

    public boolean 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. If false, then don't track the viewport's width. This allows horizontal scrolling if the JViewport is itself embedded in a JScrollPane.

    Specified by:
    getScrollableTracksViewportWidth sample code for javax.swing.Scrollable.getScrollableTracksViewportWidth() definition code for javax.swing.Scrollable.getScrollableTracksViewportWidth() in interface Scrollable sample code for javax.swing.Scrollable definition code for javax.swing.Scrollable
    Returns:
    true if viewport is wider than the JList's preferred width, otherwise false
    See Also:
    Scrollable.getScrollableTracksViewportWidth() sample code for javax.swing.Scrollable.getScrollableTracksViewportWidth() definition code for javax.swing.Scrollable.getScrollableTracksViewportWidth()

    getScrollableTracksViewportHeight sample code for javax.swing.JList.getScrollableTracksViewportHeight() definition code for javax.swing.JList.getScrollableTracksViewportHeight()

    public boolean 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. If false, then don't track the viewport's height. This allows vertical scrolling if the JViewport is itself embedded in a JScrollPane.

    Specified by:
    getScrollableTracksViewportHeight sample code for javax.swing.Scrollable.getScrollableTracksViewportHeight() definition code for javax.swing.Scrollable.getScrollableTracksViewportHeight() in interface Scrollable sample code for javax.swing.Scrollable definition code for javax.swing.Scrollable
    Returns:
    true if viewport is taller than Jlist's preferred height, otherwise false
    See Also:
    Scrollable.getScrollableTracksViewportHeight() sample code for javax.swing.Scrollable.getScrollableTracksViewportHeight() definition code for javax.swing.Scrollable.getScrollableTracksViewportHeight()

    paramString sample code for javax.swing.JList.paramString() definition code for javax.swing.JList.paramString()

    protected String sample code for java.lang.String definition code for java.lang.String  paramString()
    Returns a string representation of this JList. 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 sample code for javax.swing.JComponent.paramString() definition code for javax.swing.JComponent.paramString() in class JComponent sample code for javax.swing.JComponent definition code for javax.swing.JComponent
    Returns:
    a string representation of this JList.

    getAccessibleContext sample code for javax.swing.JList.getAccessibleContext() definition code for javax.swing.JList.getAccessibleContext()

    public AccessibleContext sample code for javax.accessibility.AccessibleContext definition code for javax.accessibility.AccessibleContext  getAccessibleContext()
    Gets the AccessibleContext associated with this JList. For JLists, the AccessibleContext takes the form of an AccessibleJList. A new AccessibleJList instance is created if necessary.

    Specified by:
    getAccessibleContext sample code for javax.accessibility.Accessible.getAccessibleContext() definition code for javax.accessibility.Accessible.getAccessibleContext() in interface Accessible sample code for javax.accessibility.Accessible definition code for javax.accessibility.Accessible
    Overrides:
    getAccessibleContext sample code for javax.swing.JComponent.getAccessibleContext() definition code for javax.swing.JComponent.getAccessibleContext() in class JComponent sample code for javax.swing.JComponent definition code for javax.swing.JComponent
    Returns:
    an AccessibleJList that serves as the AccessibleContext of this JList