java.awt
Class List

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.List
All Implemented Interfaces:
ImageObserver sample code for java.awt.image.ImageObserver definition code for java.awt.image.ImageObserver , ItemSelectable sample code for java.awt.ItemSelectable definition code for java.awt.ItemSelectable , 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

public class List
extends Component sample code for java.awt.Component definition code for java.awt.Component
implements ItemSelectable sample code for java.awt.ItemSelectable definition code for java.awt.ItemSelectable , Accessible sample code for javax.accessibility.Accessible definition code for javax.accessibility.Accessible

The List component presents the user with a scrolling list of text items. The list can be set up so that the user can choose either one item or multiple items.

For example, the code . . .


 List lst = new List(4, false);
 lst.add("Mercury");
 lst.add("Venus");
 lst.add("Earth");
 lst.add("JavaSoft");
 lst.add("Mars");
 lst.add("Jupiter");
 lst.add("Saturn");
 lst.add("Uranus");
 lst.add("Neptune");
 lst.add("Pluto");
 cnt.add(lst);
 

where cnt is a container, produces the following scrolling list:

Shows a list containing: Venus, Earth, JavaSoft, and Mars. Javasoft is selected.

If the List allows multiple selections, then clicking on an item that is already selected deselects it. In the preceding example, only one item from the scrolling list can be selected at a time, since the second argument when creating the new scrolling list is false. If the List does not allow multiple selections, selecting an item causes any other selected item to be deselected.

Note that the list in the example shown was created with four visible rows. Once the list has been created, the number of visible rows cannot be changed. A default List is created with four rows, so that lst = new List() is equivalent to list = new List(4, false).

Beginning with Java 1.1, the Abstract Window Toolkit sends the List object all mouse, keyboard, and focus events that occur over it. (The old AWT event model is being maintained only for backwards compatibility, and its use is discouraged.)

When an item is selected or deselected by the user, AWT sends an instance of ItemEvent to the list. When the user double-clicks on an item in a scrolling list, AWT sends an instance of ActionEvent to the list following the item event. AWT also generates an action event when the user presses the return key while an item in the list is selected.

If an application wants to perform some action based on an item in this list being selected or activated by the user, it should implement ItemListener or ActionListener as appropriate and register the new listener to receive events from this list.

For multiple-selection scrolling lists, it is considered a better user interface to use an external gesture (such as clicking on a button) to trigger the action.

Since:
JDK1.0
See Also:
ItemEvent sample code for java.awt.event.ItemEvent definition code for java.awt.event.ItemEvent , ItemListener sample code for java.awt.event.ItemListener definition code for java.awt.event.ItemListener , ActionEvent sample code for java.awt.event.ActionEvent definition code for java.awt.event.ActionEvent , ActionListener sample code for java.awt.event.ActionListener definition code for java.awt.event.ActionListener , Serialized Form

Nested Class Summary
protected  class List.AccessibleAWTList sample code for java.awt.List.AccessibleAWTList definition code for java.awt.List.AccessibleAWTList
          This class implements accessibility support for the List class.
 
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
 
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
List sample code for java.awt.List.List() definition code for java.awt.List.List() ()
          Creates a new scrolling list.
List sample code for java.awt.List.List(int) definition code for java.awt.List.List(int) (int rows)
          Creates a new scrolling list initialized with the specified number of visible lines.
List sample code for java.awt.List.List(int, boolean) definition code for java.awt.List.List(int, boolean) (int rows, boolean multipleMode)
          Creates a new scrolling list initialized to display the specified number of rows.
 
Method Summary
 void add sample code for java.awt.List.add(java.lang.String) definition code for java.awt.List.add(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  item)
          Adds the specified item to the end of scrolling list.
 void add sample code for java.awt.List.add(java.lang.String, int) definition code for java.awt.List.add(java.lang.String, int) (String sample code for java.lang.String definition code for java.lang.String  item, int index)
          Adds the specified item to the the scrolling list at the position indicated by the index.
 void addActionListener sample code for java.awt.List.addActionListener(java.awt.event.ActionListener) definition code for java.awt.List.addActionListener(java.awt.event.ActionListener) (ActionListener sample code for java.awt.event.ActionListener definition code for java.awt.event.ActionListener  l)
          Adds the specified action listener to receive action events from this list.
 void addItem sample code for java.awt.List.addItem(java.lang.String) definition code for java.awt.List.addItem(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  item)
          Deprecated. replaced by add(String).
 void addItem sample code for java.awt.List.addItem(java.lang.String, int) definition code for java.awt.List.addItem(java.lang.String, int) (String sample code for java.lang.String definition code for java.lang.String  item, int index)
          Deprecated. replaced by add(String, int).
 void addItemListener sample code for java.awt.List.addItemListener(java.awt.event.ItemListener) definition code for java.awt.List.addItemListener(java.awt.event.ItemListener) (ItemListener sample code for java.awt.event.ItemListener definition code for java.awt.event.ItemListener  l)
          Adds the specified item listener to receive item events from this list.
 void addNotify sample code for java.awt.List.addNotify() definition code for java.awt.List.addNotify() ()
          Creates the peer for the list.
 boolean allowsMultipleSelections sample code for java.awt.List.allowsMultipleSelections() definition code for java.awt.List.allowsMultipleSelections() ()
          Deprecated. As of JDK version 1.1, replaced by isMultipleMode().
 void clear sample code for java.awt.List.clear() definition code for java.awt.List.clear() ()
          Deprecated. As of JDK version 1.1, replaced by removeAll().
 int countItems sample code for java.awt.List.countItems() definition code for java.awt.List.countItems() ()
          Deprecated. As of JDK version 1.1, replaced by getItemCount().
 void delItem sample code for java.awt.List.delItem(int) definition code for java.awt.List.delItem(int) (int position)
          Deprecated. replaced by remove(String) and remove(int).
 void delItems sample code for java.awt.List.delItems(int, int) definition code for java.awt.List.delItems(int, int) (int start, int end)
          Deprecated. As of JDK version 1.1, Not for public use in the future. This method is expected to be retained only as a package private method.
 void deselect sample code for java.awt.List.deselect(int) definition code for java.awt.List.deselect(int) (int index)
          Deselects the item at the specified index.
 AccessibleContext sample code for javax.accessibility.AccessibleContext definition code for javax.accessibility.AccessibleContext getAccessibleContext sample code for java.awt.List.getAccessibleContext() definition code for java.awt.List.getAccessibleContext() ()
          Gets the AccessibleContext associated with this List.
 ActionListener sample code for java.awt.event.ActionListener definition code for java.awt.event.ActionListener [] getActionListeners sample code for java.awt.List.getActionListeners() definition code for java.awt.List.getActionListeners() ()
          Returns an array of all the action listeners registered on this list.
 String sample code for java.lang.String definition code for java.lang.String getItem sample code for java.awt.List.getItem(int) definition code for java.awt.List.getItem(int) (int index)
          Gets the item associated with the specified index.
 int getItemCount sample code for java.awt.List.getItemCount() definition code for java.awt.List.getItemCount() ()
          Gets the number of items in the list.
 ItemListener sample code for java.awt.event.ItemListener definition code for java.awt.event.ItemListener [] getItemListeners sample code for java.awt.List.getItemListeners() definition code for java.awt.List.getItemListeners() ()
          Returns an array of all the item listeners registered on this list.
 String sample code for java.lang.String definition code for java.lang.String [] getItems sample code for java.awt.List.getItems() definition code for java.awt.List.getItems() ()
          Gets the items in the list.
<T extends EventListener sample code for java.util.EventListener definition code for java.util.EventListener >
T[]
getListeners sample code for java.awt.List.getListeners(java.lang.Class) definition code for java.awt.List.getListeners(java.lang.Class) (Class sample code for java.lang.Class definition code for java.lang.Class <T> listenerType)
          Returns an array of all the objects currently registered as FooListeners upon this List.
 Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension getMinimumSize sample code for java.awt.List.getMinimumSize() definition code for java.awt.List.getMinimumSize() ()
          Determines the minimum size of this scrolling list.
 Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension getMinimumSize sample code for java.awt.List.getMinimumSize(int) definition code for java.awt.List.getMinimumSize(int) (int rows)
          Gets the minumum dimensions for a list with the specified number of rows.
 Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension getPreferredSize sample code for java.awt.List.getPreferredSize() definition code for java.awt.List.getPreferredSize() ()
          Gets the preferred size of this scrolling list.
 Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension getPreferredSize sample code for java.awt.List.getPreferredSize(int) definition code for java.awt.List.getPreferredSize(int) (int rows)
          Gets the preferred dimensions for a list with the specified number of rows.
 int getRows sample code for java.awt.List.getRows() definition code for java.awt.List.getRows() ()
          Gets the number of visible lines in this list.
 int getSelectedIndex sample code for java.awt.List.getSelectedIndex() definition code for java.awt.List.getSelectedIndex() ()
          Gets the index of the selected item on the list,
 int[] getSelectedIndexes sample code for java.awt.List.getSelectedIndexes() definition code for java.awt.List.getSelectedIndexes() ()
          Gets the selected indexes on the list.
 String sample code for java.lang.String definition code for java.lang.String getSelectedItem sample code for java.awt.List.getSelectedItem() definition code for java.awt.List.getSelectedItem() ()
          Gets the selected item on this scrolling list.
 String sample code for java.lang.String definition code for java.lang.String [] getSelectedItems sample code for java.awt.List.getSelectedItems() definition code for java.awt.List.getSelectedItems() ()
          Gets the selected items on this scrolling list.
 Object sample code for java.lang.Object definition code for java.lang.Object [] getSelectedObjects sample code for java.awt.List.getSelectedObjects() definition code for java.awt.List.getSelectedObjects() ()
          Gets the selected items on this scrolling list in an array of Objects.
 int getVisibleIndex sample code for java.awt.List.getVisibleIndex() definition code for java.awt.List.getVisibleIndex() ()
          Gets the index of the item that was last made visible by the method makeVisible.
 boolean isIndexSelected sample code for java.awt.List.isIndexSelected(int) definition code for java.awt.List.isIndexSelected(int) (int index)
          Determines if the specified item in this scrolling list is selected.
 boolean isMultipleMode sample code for java.awt.List.isMultipleMode() definition code for java.awt.List.isMultipleMode() ()
          Determines whether this list allows multiple selections.
 boolean isSelected sample code for java.awt.List.isSelected(int) definition code for java.awt.List.isSelected(int) (int index)
          Deprecated. As of JDK version 1.1, replaced by isIndexSelected(int).
 void makeVisible sample code for java.awt.List.makeVisible(int) definition code for java.awt.List.makeVisible(int) (int index)
          Makes the item at the specified index visible.
 Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension minimumSize sample code for java.awt.List.minimumSize() definition code for java.awt.List.minimumSize() ()
          Deprecated. As of JDK version 1.1, replaced by getMinimumSize().
 Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension minimumSize sample code for java.awt.List.minimumSize(int) definition code for java.awt.List.minimumSize(int) (int rows)
          Deprecated. As of JDK version 1.1, replaced by getMinimumSize(int).
protected  String sample code for java.lang.String definition code for java.lang.String paramString sample code for java.awt.List.paramString() definition code for java.awt.List.paramString() ()
          Returns the parameter string representing the state of this scrolling list.
 Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension preferredSize sample code for java.awt.List.preferredSize() definition code for java.awt.List.preferredSize() ()
          Deprecated. As of JDK version 1.1, replaced by getPreferredSize().
 Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension preferredSize sample code for java.awt.List.preferredSize(int) definition code for java.awt.List.preferredSize(int) (int rows)
          Deprecated. As of JDK version 1.1, replaced by getPreferredSize(int).
protected  void processActionEvent sample code for java.awt.List.processActionEvent(java.awt.event.ActionEvent) definition code for java.awt.List.processActionEvent(java.awt.event.ActionEvent) (ActionEvent sample code for java.awt.event.ActionEvent definition code for java.awt.event.ActionEvent  e)
          Processes action events occurring on this component by dispatching them to any registered ActionListener objects.
protected  void processEvent sample code for java.awt.List.processEvent(java.awt.AWTEvent) definition code for java.awt.List.processEvent(java.awt.AWTEvent) (AWTEvent sample code for java.awt.AWTEvent definition code for java.awt.AWTEvent  e)
          Processes events on this scrolling list.
protected  void processItemEvent sample code for java.awt.List.processItemEvent(java.awt.event.ItemEvent) definition code for java.awt.List.processItemEvent(java.awt.event.ItemEvent) (ItemEvent sample code for java.awt.event.ItemEvent definition code for java.awt.event.ItemEvent  e)
          Processes item events occurring on this list by dispatching them to any registered ItemListener objects.
 void remove sample code for java.awt.List.remove(int) definition code for java.awt.List.remove(int) (int position)
          Removes the item at the specified position from this scrolling list.
 void remove sample code for java.awt.List.remove(java.lang.String) definition code for java.awt.List.remove(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  item)
          Removes the first occurrence of an item from the list.
 void removeActionListener sample code for java.awt.List.removeActionListener(java.awt.event.ActionListener) definition code for java.awt.List.removeActionListener(java.awt.event.ActionListener) (ActionListener sample code for java.awt.event.ActionListener definition code for java.awt.event.ActionListener  l)
          Removes the specified action listener so that it no longer receives action events from this list.
 void removeAll sample code for java.awt.List.removeAll() definition code for java.awt.List.removeAll() ()
          Removes all items from this list.
 void removeItemListener sample code for java.awt.List.removeItemListener(java.awt.event.ItemListener) definition code for java.awt.List.removeItemListener(java.awt.event.ItemListener) (ItemListener sample code for java.awt.event.ItemListener definition code for java.awt.event.ItemListener  l)
          Removes the specified item listener so that it no longer receives item events from this list.
 void removeNotify sample code for java.awt.List.removeNotify() definition code for java.awt.List.removeNotify() ()
          Removes the peer for this list.
 void replaceItem sample code for java.awt.List.replaceItem(java.lang.String, int) definition code for java.awt.List.replaceItem(java.lang.String, int) (String sample code for java.lang.String definition code for java.lang.String  newValue, int index)
          Replaces the item at the specified index in the scrolling list with the new string.
 void select sample code for java.awt.List.select(int) definition code for java.awt.List.select(int) (int index)
          Selects the item at the specified index in the scrolling list.
 void setMultipleMode sample code for java.awt.List.setMultipleMode(boolean) definition code for java.awt.List.setMultipleMode(boolean) (boolean b)
          Sets the flag that determines whether this list allows multiple selections.
 void setMultipleSelections sample code for java.awt.List.setMultipleSelections(boolean) definition code for java.awt.List.setMultipleSelections(boolean) (boolean b)
          Deprecated. As of JDK version 1.1, replaced by setMultipleMode(boolean).
 
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) , addPropertyChangeListener sample code for java.awt.Component.addPropertyChangeListener(java.beans.PropertyChangeListener) definition code for java.awt.Component.addPropertyChangeListener(java.beans.PropertyChangeListener) , addPropertyChangeListener sample code for java.awt.Component.addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener) definition code for java.awt.Component.addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener) , applyComponentOrientation sample code for java.awt.Component.applyComponentOrientation(java.awt.ComponentOrientation) definition code for java.awt.Component.applyComponentOrientation(java.awt.ComponentOrientation) , areFocusTraversalKeysSet sample code for java.awt.Component.areFocusTraversalKeysSet(int) definition code for java.awt.Component.areFocusTraversalKeysSet(int) , 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(int, int) definition code for java.awt.Component.contains(int, int) , 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) , deliverEvent sample code for java.awt.Component.deliverEvent(java.awt.Event) definition code for java.awt.Component.deliverEvent(java.awt.Event) , disable sample code for java.awt.Component.disable() definition code for java.awt.Component.disable() , 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) , doLayout sample code for java.awt.Component.doLayout() definition code for java.awt.Component.doLayout() , enable sample code for java.awt.Component.enable() definition code for java.awt.Component.enable() , 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, boolean, boolean) definition code for java.awt.Component.firePropertyChange(java.lang.String, boolean, 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, char, char) definition code for java.awt.Component.firePropertyChange(java.lang.String, char, char) , 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, int, int) definition code for java.awt.Component.firePropertyChange(java.lang.String, int, int) , 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) , getAlignmentX sample code for java.awt.Component.getAlignmentX() definition code for java.awt.Component.getAlignmentX() , getAlignmentY sample code for java.awt.Component.getAlignmentY() definition code for java.awt.Component.getAlignmentY() , 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() , getBounds sample code for java.awt.Component.getBounds(java.awt.Rectangle) definition code for java.awt.Component.getBounds(java.awt.Rectangle) , getColorModel sample code for java.awt.Component.getColorModel() definition code for java.awt.Component.getColorModel() , getComponentAt sample code for java.awt.Component.getComponentAt(int, int) definition code for java.awt.Component.getComponentAt(int, int) , getComponentAt sample code for java.awt.Component.getComponentAt(java.awt.Point) definition code for java.awt.Component.getComponentAt(java.awt.Point) , 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() , getFocusTraversalKeys sample code for java.awt.Component.getFocusTraversalKeys(int) definition code for java.awt.Component.getFocusTraversalKeys(int) , 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() , getFontMetrics sample code for java.awt.Component.getFontMetrics(java.awt.Font) definition code for java.awt.Component.getFontMetrics(java.awt.Font) , getForeground sample code for java.awt.Component.getForeground() definition code for java.awt.Component.getForeground() , getGraphics sample code for java.awt.Component.getGraphics() definition code for java.awt.Component.getGraphics() , getGraphicsConfiguration sample code for java.awt.Component.getGraphicsConfiguration() definition code for java.awt.Component.getGraphicsConfiguration() , getHeight sample code for java.awt.Component.getHeight() definition code for java.awt.Component.getHeight() , 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() , getLocation sample code for java.awt.Component.getLocation(java.awt.Point) definition code for java.awt.Component.getLocation(java.awt.Point) , getLocationOnScreen sample code for java.awt.Component.getLocationOnScreen() definition code for java.awt.Component.getLocationOnScreen() , getMaximumSize sample code for java.awt.Component.getMaximumSize() definition code for java.awt.Component.getMaximumSize() , 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() , getSize sample code for java.awt.Component.getSize(java.awt.Dimension) definition code for java.awt.Component.getSize(java.awt.Dimension) , 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() , getWidth sample code for java.awt.Component.getWidth() definition code for java.awt.Component.getWidth() , getX sample code for java.awt.Component.getX() definition code for java.awt.Component.getX() , getY sample code for java.awt.Component.getY() definition code for java.awt.Component.getY() , 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) , invalidate sample code for java.awt.Component.invalidate() definition code for java.awt.Component.invalidate() , 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() , isDoubleBuffered sample code for java.awt.Component.isDoubleBuffered() definition code for java.awt.Component.isDoubleBuffered() , 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() , isFocusCycleRoot sample code for java.awt.Component.isFocusCycleRoot(java.awt.Container) definition code for java.awt.Component.isFocusCycleRoot(java.awt.Container) , 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() , isOpaque sample code for java.awt.Component.isOpaque() definition code for java.awt.Component.isOpaque() , 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) , layout sample code for java.awt.Component.layout() definition code for java.awt.Component.layout() , 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.PrintStream, int) definition code for java.awt.Component.list(java.io.PrintStream, int) , list sample code for java.awt.Component.list(java.io.PrintWriter) definition code for java.awt.Component.list(java.io.PrintWriter) , list sample code for java.awt.Component.list(java.io.PrintWriter, int) definition code for java.awt.Component.list(java.io.PrintWriter, int) , locate sample code for java.awt.Component.locate(int, int) definition code for java.awt.Component.locate(int, int) , 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() , paint sample code for java.awt.Component.paint(java.awt.Graphics) definition code for java.awt.Component.paint(java.awt.Graphics) , 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) , print sample code for java.awt.Component.print(java.awt.Graphics) definition code for java.awt.Component.print(java.awt.Graphics) , printAll sample code for java.awt.Component.printAll(java.awt.Graphics) definition code for java.awt.Component.printAll(java.awt.Graphics) , 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) , processKeyEvent sample code for java.awt.Component.processKeyEvent(java.awt.event.KeyEvent) definition code for java.awt.Component.processKeyEvent(java.awt.event.KeyEvent) , processMouseEvent sample code for java.awt.Component.processMouseEvent(java.awt.event.MouseEvent) definition code for java.awt.Component.processMouseEvent(java.awt.event.MouseEvent) , processMouseMotionEvent sample code for java.awt.Component.processMouseMotionEvent(java.awt.event.MouseEvent) definition code for java.awt.Component.processMouseMotionEvent(java.awt.event.MouseEvent) , 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) , repaint sample code for java.awt.Component.repaint(long, int, int, int, int) definition code for java.awt.Component.repaint(long, int, int, int, int) , requestFocus sample code for java.awt.Component.requestFocus() definition code for java.awt.Component.requestFocus() , requestFocus sample code for java.awt.Component.requestFocus(boolean) definition code for java.awt.Component.requestFocus(boolean) , requestFocusInWindow sample code for java.awt.Component.requestFocusInWindow() definition code for java.awt.Component.requestFocusInWindow() , requestFocusInWindow sample code for java.awt.Component.requestFocusInWindow(boolean) definition code for java.awt.Component.requestFocusInWindow(boolean) , reshape sample code for java.awt.Component.reshape(int, int, int, int) definition code for java.awt.Component.reshape(int, int, int, int) , 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) , setBackground sample code for java.awt.Component.setBackground(java.awt.Color) definition code for java.awt.Component.setBackground(java.awt.Color) , 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) , setEnabled sample code for java.awt.Component.setEnabled(boolean) definition code for java.awt.Component.setEnabled(boolean) , setFocusable sample code for java.awt.Component.setFocusable(boolean) definition code for java.awt.Component.setFocusable(boolean) , setFocusTraversalKeys sample code for java.awt.Component.setFocusTraversalKeys(int, java.util.Set) definition code for java.awt.Component.setFocusTraversalKeys(int, java.util.Set) , setFocusTraversalKeysEnabled sample code for java.awt.Component.setFocusTraversalKeysEnabled(boolean) definition code for java.awt.Component.setFocusTraversalKeysEnabled(boolean) , setFont sample code for java.awt.Component.setFont(java.awt.Font) definition code for java.awt.Component.setFont(java.awt.Font) , setForeground sample code for java.awt.Component.setForeground(java.awt.Color) definition code for java.awt.Component.setForeground(java.awt.Color) , 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) , setMaximumSize sample code for java.awt.Component.setMaximumSize(java.awt.Dimension) definition code for java.awt.Component.setMaximumSize(java.awt.Dimension) , setMinimumSize sample code for java.awt.Component.setMinimumSize(java.awt.Dimension) definition code for java.awt.Component.setMinimumSize(java.awt.Dimension) , setName sample code for java.awt.Component.setName(java.lang.String) definition code for java.awt.Component.setName(java.lang.String) , setPreferredSize sample code for java.awt.Component.setPreferredSize(java.awt.Dimension) definition code for java.awt.Component.setPreferredSize(java.awt.Dimension) , 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) , setVisible sample code for java.awt.Component.setVisible(boolean) definition code for java.awt.Component.setVisible(boolean) , 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() , transferFocusBackward sample code for java.awt.Component.transferFocusBackward() definition code for java.awt.Component.transferFocusBackward() , transferFocusUpCycle sample code for java.awt.Component.transferFocusUpCycle() definition code for java.awt.Component.transferFocusUpCycle() , update sample code for java.awt.Component.update(java.awt.Graphics) definition code for java.awt.Component.update(java.awt.Graphics) , validate sample code for java.awt.Component.validate() definition code for java.awt.Component.validate()
 
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)
 

Constructor Detail

List sample code for java.awt.List() definition code for java.awt.List()

public List()
     throws HeadlessException sample code for java.awt.HeadlessException definition code for java.awt.HeadlessException 
Creates a new scrolling list. By default, there are four visible lines and multiple selections are not allowed. Note that this is a convenience method for List(0, false). Also note that the number of visible lines in the list cannot be changed after it has been created.

Throws:
HeadlessException sample code for java.awt.HeadlessException definition code for java.awt.HeadlessException - if GraphicsEnvironment.isHeadless() returns true.
See Also:
GraphicsEnvironment.isHeadless() sample code for java.awt.GraphicsEnvironment.isHeadless() definition code for java.awt.GraphicsEnvironment.isHeadless()

List sample code for java.awt.List(int) definition code for java.awt.List(int)

public List(int rows)
     throws HeadlessException sample code for java.awt.HeadlessException definition code for java.awt.HeadlessException 
Creates a new scrolling list initialized with the specified number of visible lines. By default, multiple selections are not allowed. Note that this is a convenience method for List(rows, false). Also note that the number of visible rows in the list cannot be changed after it has been created.

Parameters:
rows - the number of items to show.
Throws:
HeadlessException sample code for java.awt.HeadlessException definition code for java.awt.HeadlessException - if GraphicsEnvironment.isHeadless() returns true.
Since:
JDK1.1
See Also:
GraphicsEnvironment.isHeadless() sample code for java.awt.GraphicsEnvironment.isHeadless() definition code for java.awt.GraphicsEnvironment.isHeadless()

List sample code for java.awt.List(int, boolean) definition code for java.awt.List(int, boolean)

public List(int rows,
            boolean multipleMode)
     throws HeadlessException sample code for java.awt.HeadlessException definition code for java.awt.HeadlessException 
Creates a new scrolling list initialized to display the specified number of rows. Note that if zero rows are specified, then the list will be created with a default of four rows. Also note that the number of visible rows in the list cannot be changed after it has been created. If the value of multipleMode is true, then the user can select multiple items from the list. If it is false, only one item at a time can be selected.

Parameters:
rows - the number of items to show.
multipleMode - if true, then multiple selections are allowed; otherwise, only one item can be selected at a time.
Throws:
HeadlessException sample code for java.awt.HeadlessException definition code for java.awt.HeadlessException - if GraphicsEnvironment.isHeadless() returns true.
See Also:
GraphicsEnvironment.isHeadless() sample code for java.awt.GraphicsEnvironment.isHeadless() definition code for java.awt.GraphicsEnvironment.isHeadless()
Method Detail

addNotify sample code for java.awt.List.addNotify() definition code for java.awt.List.addNotify()

public void addNotify()
Creates the peer for the list. The peer allows us to modify the list's appearance without changing its functionality.

Overrides:
addNotify sample code for java.awt.Component.addNotify() definition code for java.awt.Component.addNotify() in class Component sample code for java.awt.Component definition code for java.awt.Component
See Also:
Component.isDisplayable() sample code for java.awt.Component.isDisplayable() definition code for java.awt.Component.isDisplayable() , Component.removeNotify() sample code for java.awt.Component.removeNotify() definition code for java.awt.Component.removeNotify()

removeNotify sample code for java.awt.List.removeNotify() definition code for java.awt.List.removeNotify()

public void removeNotify()
Removes the peer for this list. The peer allows us to modify the list's appearance without changing its functionality.

Overrides:
removeNotify sample code for java.awt.Component.removeNotify() definition code for java.awt.Component.removeNotify() in class Component sample code for java.awt.Component definition code for java.awt.Component
See Also:
Component.isDisplayable() sample code for java.awt.Component.isDisplayable() definition code for java.awt.Component.isDisplayable() , Component.addNotify() sample code for java.awt.Component.addNotify() definition code for java.awt.Component.addNotify()

getItemCount sample code for java.awt.List.getItemCount() definition code for java.awt.List.getItemCount()

public int getItemCount()
Gets the number of items in the list.

Returns:
the number of items in the list
Since:
JDK1.1
See Also:
getItem(int) sample code for java.awt.List.getItem(int) definition code for java.awt.List.getItem(int)

countItems sample code for java.awt.List.countItems() definition code for java.awt.List.countItems()

@Deprecated
public int countItems()
Deprecated. As of JDK version 1.1, replaced by getItemCount().


getItem sample code for java.awt.List.getItem(int) definition code for java.awt.List.getItem(int)

public String sample code for java.lang.String definition code for java.lang.String  getItem(int index)
Gets the item associated with the specified index.

Parameters:
index - the position of the item
Returns:
an item that is associated with the specified index
See Also:
getItemCount() sample code for java.awt.List.getItemCount() definition code for java.awt.List.getItemCount()

getItems sample code for java.awt.List.getItems() definition code for java.awt.List.getItems()

public String sample code for java.lang.String definition code for java.lang.String [] getItems()
Gets the items in the list.

Returns:
a string array containing items of the list
Since:
JDK1.1
See Also:
select(int) sample code for java.awt.List.select(int) definition code for java.awt.List.select(int) , deselect(int) sample code for java.awt.List.deselect(int) definition code for java.awt.List.deselect(int) , isIndexSelected(int) sample code for java.awt.List.isIndexSelected(int) definition code for java.awt.List.isIndexSelected(int)

add sample code for java.awt.List.add(java.lang.String) definition code for java.awt.List.add(java.lang.String)

public void add(String sample code for java.lang.String definition code for java.lang.String  item)
Adds the specified item to the end of scrolling list.

Parameters:
item - the item to be added
Since:
JDK1.1

addItem sample code for java.awt.List.addItem(java.lang.String) definition code for java.awt.List.addItem(java.lang.String)

@Deprecated
public void addItem(String sample code for java.lang.String definition code for java.lang.String  item)
Deprecated. replaced by add(String).


add sample code for java.awt.List.add(java.lang.String, int) definition code for java.awt.List.add(java.lang.String, int)

public void add(String sample code for java.lang.String definition code for java.lang.String  item,
                int index)
Adds the specified item to the the scrolling list at the position indicated by the index. The index is zero-based. If the value of the index is less than zero, or if the value of the index is greater than or equal to the number of items in the list, then the item is added to the end of the list.

Parameters:
item - the item to be added; if this parameter is null then the item is treated as an empty string, ""
index - the position at which to add the item
Since:
JDK1.1

addItem sample code for java.awt.List.addItem(java.lang.String, int) definition code for java.awt.List.addItem(java.lang.String, int)

@Deprecated
public void addItem(String sample code for java.lang.String definition code for java.lang.String  item,
                               int index)
Deprecated. replaced by add(String, int).


replaceItem sample code for java.awt.List.replaceItem(java.lang.String, int) definition code for java.awt.List.replaceItem(java.lang.String, int)

public void replaceItem(String sample code for java.lang.String definition code for java.lang.String  newValue,
                        int index)
Replaces the item at the specified index in the scrolling list with the new string.

Parameters:
newValue - a new string to replace an existing item
index - the position of the item to replace
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if index is out of range

removeAll sample code for java.awt.List.removeAll() definition code for java.awt.List.removeAll()

public void removeAll()
Removes all items from this list.

Since:
JDK1.1
See Also:
remove(java.lang.String) sample code for java.awt.List.remove(java.lang.String) definition code for java.awt.List.remove(java.lang.String) , delItems(int, int) sample code for java.awt.List.delItems(int, int) definition code for java.awt.List.delItems(int, int)

clear sample code for java.awt.List.clear() definition code for java.awt.List.clear()

@Deprecated
public void clear()
Deprecated. As of JDK version 1.1, replaced by removeAll().


remove sample code for java.awt.List.remove(java.lang.String) definition code for java.awt.List.remove(java.lang.String)

public void remove(String sample code for java.lang.String definition code for java.lang.String  item)
Removes the first occurrence of an item from the list. If the specified item is selected, and is the only selected item in the list, the list is set to have no selection.

Parameters:
item - the item to remove from the list
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the item doesn't exist in the list
Since:
JDK1.1

remove sample code for java.awt.List.remove(int) definition code for java.awt.List.remove(int)

public void remove(int position)
Removes the item at the specified position from this scrolling list. If the item with the specified position is selected, and is the only selected item in the list, the list is set to have no selection.

Parameters:
position - the index of the item to delete
Throws:
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if the position is less than 0 or greater than getItemCount()-1
Since:
JDK1.1
See Also:
add(String, int) sample code for java.awt.List.add(java.lang.String, int) definition code for java.awt.List.add(java.lang.String, int)

delItem sample code for java.awt.List.delItem(int) definition code for java.awt.List.delItem(int)

@Deprecated
public void delItem(int position)
Deprecated. replaced by remove(String) and remove(int).


getSelectedIndex sample code for java.awt.List.getSelectedIndex() definition code for java.awt.List.getSelectedIndex()

public int getSelectedIndex()
Gets the index of the selected item on the list,

Returns:
the index of the selected item; if no item is selected, or if multiple items are selected, -1 is returned.
See Also:
select(int) sample code for java.awt.List.select(int) definition code for java.awt.List.select(int) , deselect(int) sample code for java.awt.List.deselect(int) definition code for java.awt.List.deselect(int) , isIndexSelected(int) sample code for java.awt.List.isIndexSelected(int) definition code for java.awt.List.isIndexSelected(int)

getSelectedIndexes sample code for java.awt.List.getSelectedIndexes() definition code for java.awt.List.getSelectedIndexes()

public int[] getSelectedIndexes()
Gets the selected indexes on the list.

Returns:
an array of the selected indexes on this scrolling list; if no item is selected, a zero-length array is returned.
See Also:
select(int) sample code for java.awt.List.select(int) definition code for java.awt.List.select(int) , deselect(int) sample code for java.awt.List.deselect(int) definition code for java.awt.List.deselect(int) , isIndexSelected(int) sample code for java.awt.List.isIndexSelected(int) definition code for java.awt.List.isIndexSelected(int)

getSelectedItem sample code for java.awt.List.getSelectedItem() definition code for java.awt.List.getSelectedItem()

public String sample code for java.lang.String definition code for java.lang.String  getSelectedItem()
Gets the selected item on this scrolling list.

Returns:
the selected item on the list; if no item is selected, or if multiple items are selected, null is returned.
See Also:
select(int) sample code for java.awt.List.select(int) definition code for java.awt.List.select(int) , deselect(int) sample code for java.awt.List.deselect(int) definition code for java.awt.List.deselect(int) , isIndexSelected(int) sample code for java.awt.List.isIndexSelected(int) definition code for java.awt.List.isIndexSelected(int)

getSelectedItems sample code for java.awt.List.getSelectedItems() definition code for java.awt.List.getSelectedItems()

public String sample code for java.lang.String definition code for java.lang.String [] getSelectedItems()
Gets the selected items on this scrolling list.

Returns:
an array of the selected items on this scrolling list; if no item is selected, a zero-length array is returned.
See Also:
select(int) sample code for java.awt.List.select(int) definition code for java.awt.List.select(int) , deselect(int) sample code for java.awt.List.deselect(int) definition code for java.awt.List.deselect(int) , isIndexSelected(int) sample code for java.awt.List.isIndexSelected(int) definition code for java.awt.List.isIndexSelected(int)

getSelectedObjects sample code for java.awt.List.getSelectedObjects() definition code for java.awt.List.getSelectedObjects()

public Object sample code for java.lang.Object definition code for java.lang.Object [] getSelectedObjects()
Gets the selected items on this scrolling list in an array of Objects.

Specified by:
getSelectedObjects sample code for java.awt.ItemSelectable.getSelectedObjects() definition code for java.awt.ItemSelectable.getSelectedObjects() in interface ItemSelectable sample code for java.awt.ItemSelectable definition code for java.awt.ItemSelectable
Returns:
an array of Objects representing the selected items on this scrolling list; if no item is selected, a zero-length array is returned.
See Also:
getSelectedItems() sample code for java.awt.List.getSelectedItems() definition code for java.awt.List.getSelectedItems() , ItemSelectable sample code for java.awt.ItemSelectable definition code for java.awt.ItemSelectable

select sample code for java.awt.List.select(int) definition code for java.awt.List.select(int)

public void select(int index)
Selects the item at the specified index in the scrolling list.

Note that passing out of range parameters is invalid, and will result in unspecified behavior.

Note that this method should be primarily used to initially select an item in this component. Programmatically calling this method will not trigger an ItemEvent. The only way to trigger an ItemEvent is by user interaction.

Parameters:
index - the position of the item to select
See Also:
getSelectedItem() sample code for java.awt.List.getSelectedItem() definition code for java.awt.List.getSelectedItem() , deselect(int) sample code for java.awt.List.deselect(int) definition code for java.awt.List.deselect(int) , isIndexSelected(int) sample code for java.awt.List.isIndexSelected(int) definition code for java.awt.List.isIndexSelected(int)

deselect sample code for java.awt.List.deselect(int) definition code for java.awt.List.deselect(int)

public void deselect(int index)
Deselects the item at the specified index.

Note that passing out of range parameters is invalid, and will result in unspecified behavior.

If the item at the specified index is not selected, then the operation is ignored.

Parameters:
index - the position of the item to deselect
See Also:
select(int) sample code for java.awt.List.select(int) definition code for java.awt.List.select(int) , getSelectedItem() sample code for java.awt.List.getSelectedItem() definition code for java.awt.List.getSelectedItem() , isIndexSelected(int) sample code for java.awt.List.isIndexSelected(int) definition code for java.awt.List.isIndexSelected(int)

isIndexSelected sample code for java.awt.List.isIndexSelected(int) definition code for java.awt.List.isIndexSelected(int)

public boolean isIndexSelected(int index)
Determines if the specified item in this scrolling list is selected.

Parameters:
index - the item to be checked
Returns:
true if the specified item has been selected; false otherwise
Since:
JDK1.1
See Also:
select(int) sample code for java.awt.List.select(int) definition code for java.awt.List.select(int) , deselect(int) sample code for java.awt.List.deselect(int) definition code for java.awt.List.deselect(int)

isSelected sample code for java.awt.List.isSelected(int) definition code for java.awt.List.isSelected(int)

@Deprecated
public boolean isSelected(int index)
Deprecated. As of JDK version 1.1, replaced by isIndexSelected(int).


getRows sample code for java.awt.List.getRows() definition code for java.awt.List.getRows()

public int getRows()
Gets the number of visible lines in this list. Note that once the List has been created, this number will never change.

Returns:
the number of visible lines in this scrolling list

isMultipleMode sample code for java.awt.List.isMultipleMode() definition code for java.awt.List.isMultipleMode()

public boolean isMultipleMode()
Determines whether this list allows multiple selections.

Returns:
true if this list allows multiple selections; otherwise, false
Since:
JDK1.1
See Also:
setMultipleMode(boolean) sample code for java.awt.List.setMultipleMode(boolean) definition code for java.awt.List.setMultipleMode(boolean)

allowsMultipleSelections sample code for java.awt.List.allowsMultipleSelections() definition code for java.awt.List.allowsMultipleSelections()

@Deprecated
public boolean allowsMultipleSelections()
Deprecated. As of JDK version 1.1, replaced by isMultipleMode().


setMultipleMode sample code for java.awt.List.setMultipleMode(boolean) definition code for java.awt.List.setMultipleMode(boolean)

public void setMultipleMode(boolean b)
Sets the flag that determines whether this list allows multiple selections. When the selection mode is changed from multiple-selection to single-selection, the selected items change as follows: If a selected item has the location cursor, only that item will remain selected. If no selected item has the location cursor, all items will be deselected.

Parameters:
b - if true then multiple selections are allowed; otherwise, only one item from the list can be selected at once
Since:
JDK1.1
See Also:
isMultipleMode() sample code for java.awt.List.isMultipleMode() definition code for java.awt.List.isMultipleMode()

setMultipleSelections sample code for java.awt.List.setMultipleSelections(boolean) definition code for java.awt.List.setMultipleSelections(boolean)

@Deprecated
public void setMultipleSelections(boolean b)
Deprecated. As of JDK version 1.1, replaced by setMultipleMode(boolean).


getVisibleIndex sample code for java.awt.List.getVisibleIndex() definition code for java.awt.List.getVisibleIndex()

public int getVisibleIndex()
Gets the index of the item that was last made visible by the method makeVisible.

Returns:
the index of the item that was last made visible
See Also:
makeVisible(int) sample code for java.awt.List.makeVisible(int) definition code for java.awt.List.makeVisible(int)

makeVisible sample code for java.awt.List.makeVisible(int) definition code for java.awt.List.makeVisible(int)

public void makeVisible(int index)
Makes the item at the specified index visible.

Parameters:
index - the position of the item
See Also:
getVisibleIndex() sample code for java.awt.List.getVisibleIndex() definition code for java.awt.List.getVisibleIndex()

getPreferredSize sample code for java.awt.List.getPreferredSize(int) definition code for java.awt.List.getPreferredSize(int)

public Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension  getPreferredSize(int rows)
Gets the preferred dimensions for a list with the specified number of rows.

Parameters:
rows - number of rows in the list
Returns:
the preferred dimensions for displaying this scrolling list given that the specified number of rows must be visible
Since:
JDK1.1
See Also:
Component.getPreferredSize() sample code for java.awt.Component.getPreferredSize() definition code for java.awt.Component.getPreferredSize()

preferredSize sample code for java.awt.List.preferredSize(int) definition code for java.awt.List.preferredSize(int)

@Deprecated
public Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension  preferredSize(int rows)
Deprecated. As of JDK version 1.1, replaced by getPreferredSize(int).


getPreferredSize sample code for java.awt.List.getPreferredSize() definition code for java.awt.List.getPreferredSize()

public Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension  getPreferredSize()
Gets the preferred size of this scrolling list.

Overrides:
getPreferredSize sample code for java.awt.Component.getPreferredSize() definition code for java.awt.Component.getPreferredSize() in class Component sample code for java.awt.Component definition code for java.awt.Component
Returns:
the preferred dimensions for displaying this scrolling list
Since:
JDK1.1
See Also:
Component.getPreferredSize() sample code for java.awt.Component.getPreferredSize() definition code for java.awt.Component.getPreferredSize()

preferredSize sample code for java.awt.List.preferredSize() definition code for java.awt.List.preferredSize()

@Deprecated
public Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension  preferredSize()
Deprecated. As of JDK version 1.1, replaced by getPreferredSize().

Overrides:
preferredSize sample code for java.awt.Component.preferredSize() definition code for java.awt.Component.preferredSize() in class Component sample code for java.awt.Component definition code for java.awt.Component

getMinimumSize sample code for java.awt.List.getMinimumSize(int) definition code for java.awt.List.getMinimumSize(int)

public Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension  getMinimumSize(int rows)
Gets the minumum dimensions for a list with the specified number of rows.

Parameters:
rows - number of rows in the list
Returns:
the minimum dimensions for displaying this scrolling list given that the specified number of rows must be visible
Since:
JDK1.1
See Also:
Component.getMinimumSize() sample code for java.awt.Component.getMinimumSize() definition code for java.awt.Component.getMinimumSize()

minimumSize sample code for java.awt.List.minimumSize(int) definition code for java.awt.List.minimumSize(int)

@Deprecated
public Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension  minimumSize(int rows)
Deprecated. As of JDK version 1.1, replaced by getMinimumSize(int).


getMinimumSize sample code for java.awt.List.getMinimumSize() definition code for java.awt.List.getMinimumSize()

public Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension  getMinimumSize()
Determines the minimum size of this scrolling list.

Overrides:
getMinimumSize sample code for java.awt.Component.getMinimumSize() definition code for java.awt.Component.getMinimumSize() in class Component sample code for java.awt.Component definition code for java.awt.Component
Returns:
the minimum dimensions needed to display this scrolling list
Since:
JDK1.1
See Also:
Component.getMinimumSize() sample code for java.awt.Component.getMinimumSize() definition code for java.awt.Component.getMinimumSize()

minimumSize sample code for java.awt.List.minimumSize() definition code for java.awt.List.minimumSize()

@Deprecated
public Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension  minimumSize()
Deprecated. As of JDK version 1.1, replaced by getMinimumSize().

Overrides:
minimumSize sample code for java.awt.Component.minimumSize() definition code for java.awt.Component.minimumSize() in class Component sample code for java.awt.Component definition code for java.awt.Component

addItemListener sample code for java.awt.List.addItemListener(java.awt.event.ItemListener) definition code for java.awt.List.addItemListener(java.awt.event.ItemListener)

public void addItemListener(ItemListener sample code for java.awt.event.ItemListener definition code for java.awt.event.ItemListener  l)
Adds the specified item listener to receive item events from this list. Item events are sent in response to user input, but not in response to calls to select or deselect. If listener l is null, no exception is thrown and no action is performed.

Specified by:
addItemListener sample code for java.awt.ItemSelectable.addItemListener(java.awt.event.ItemListener) definition code for java.awt.ItemSelectable.addItemListener(java.awt.event.ItemListener) in interface ItemSelectable sample code for java.awt.ItemSelectable definition code for java.awt.ItemSelectable
Parameters:
l - the item listener
Since:
JDK1.1
See Also:
removeItemListener(java.awt.event.ItemListener) sample code for java.awt.List.removeItemListener(java.awt.event.ItemListener) definition code for java.awt.List.removeItemListener(java.awt.event.ItemListener) , getItemListeners() sample code for java.awt.List.getItemListeners() definition code for java.awt.List.getItemListeners() , select(int) sample code for java.awt.List.select(int) definition code for java.awt.List.select(int) , deselect(int) sample code for java.awt.List.deselect(int) definition code for java.awt.List.deselect(int) , ItemEvent sample code for java.awt.event.ItemEvent definition code for java.awt.event.ItemEvent , ItemListener sample code for java.awt.event.ItemListener definition code for java.awt.event.ItemListener

removeItemListener sample code for java.awt.List.removeItemListener(java.awt.event.ItemListener) definition code for java.awt.List.removeItemListener(java.awt.event.ItemListener)

public void removeItemListener(ItemListener sample code for java.awt.event.ItemListener definition code for java.awt.event.ItemListener  l)
Removes the specified item listener so that it no longer receives item events from this list. If listener l is null, no exception is thrown and no action is performed.

Specified by:
removeItemListener sample code for java.awt.ItemSelectable.removeItemListener(java.awt.event.ItemListener) definition code for java.awt.ItemSelectable.removeItemListener(java.awt.event.ItemListener) in interface ItemSelectable sample code for java.awt.ItemSelectable definition code for java.awt.ItemSelectable
Parameters:
l - the item listener
Since:
JDK1.1
See Also:
addItemListener(java.awt.event.ItemListener) sample code for java.awt.List.addItemListener(java.awt.event.ItemListener) definition code for java.awt.List.addItemListener(java.awt.event.ItemListener) , getItemListeners() sample code for java.awt.List.getItemListeners() definition code for java.awt.List.getItemListeners() , ItemEvent sample code for java.awt.event.ItemEvent definition code for java.awt.event.ItemEvent , ItemListener sample code for java.awt.event.ItemListener definition code for java.awt.event.ItemListener

getItemListeners sample code for java.awt.List.getItemListeners() definition code for java.awt.List.getItemListeners()

public ItemListener sample code for java.awt.event.ItemListener definition code for java.awt.event.ItemListener [] getItemListeners()
Returns an array of all the item listeners registered on this list.

Returns:
all of this list's ItemListeners or an empty array if no item listeners are currently registered
Since:
1.4
See Also:
addItemListener(java.awt.event.ItemListener) sample code for java.awt.List.addItemListener(java.awt.event.ItemListener) definition code for java.awt.List.addItemListener(java.awt.event.ItemListener) , removeItemListener(java.awt.event.ItemListener) sample code for java.awt.List.removeItemListener(java.awt.event.ItemListener) definition code for java.awt.List.removeItemListener(java.awt.event.ItemListener) , ItemEvent sample code for java.awt.event.ItemEvent definition code for java.awt.event.ItemEvent , ItemListener sample code for java.awt.event.ItemListener definition code for java.awt.event.ItemListener

addActionListener sample code for java.awt.List.addActionListener(java.awt.event.ActionListener) definition code for java.awt.List.addActionListener(java.awt.event.ActionListener)

public void addActionListener(ActionListener sample code for java.awt.event.ActionListener definition code for java.awt.event.ActionListener  l)
Adds the specified action listener to receive action events from this list. Action events occur when a user double-clicks on a list item or types Enter when the list has the keyboard focus.

If listener l is null, no exception is thrown and no action is performed.

Parameters:
l - the action listener
Since:
JDK1.1
See Also:
removeActionListener(java.awt.event.ActionListener) sample code for java.awt.List.removeActionListener(java.awt.event.ActionListener) definition code for java.awt.List.removeActionListener(java.awt.event.ActionListener) , getActionListeners() sample code for java.awt.List.getActionListeners() definition code for java.awt.List.getActionListeners() , ActionEvent sample code for java.awt.event.ActionEvent definition code for java.awt.event.ActionEvent , ActionListener sample code for java.awt.event.ActionListener definition code for java.awt.event.ActionListener

removeActionListener sample code for java.awt.List.removeActionListener(java.awt.event.ActionListener) definition code for java.awt.List.removeActionListener(java.awt.event.ActionListener)

public void removeActionListener(ActionListener sample code for java.awt.event.ActionListener definition code for java.awt.event.ActionListener  l)
Removes the specified action listener so that it no longer receives action events from this list. Action events occur when a user double-clicks on a list item. If listener l is null, no exception is thrown and no action is performed.

Parameters:
l - the action listener
Since:
JDK1.1
See Also:
addActionListener(java.awt.event.ActionListener) sample code for java.awt.List.addActionListener(java.awt.event.ActionListener) definition code for java.awt.List.addActionListener(java.awt.event.ActionListener) , getActionListeners() sample code for java.awt.List.getActionListeners() definition code for java.awt.List.getActionListeners() , ActionEvent sample code for java.awt.event.ActionEvent definition code for java.awt.event.ActionEvent , ActionListener sample code for java.awt.event.ActionListener definition code for java.awt.event.ActionListener

getActionListeners sample code for java.awt.List.getActionListeners() definition code for java.awt.List.getActionListeners()

public ActionListener sample code for java.awt.event.ActionListener definition code for java.awt.event.ActionListener [] getActionListeners()
Returns an array of all the action listeners registered on this list.

Returns:
all of this list's ActionListeners or an empty array if no action listeners are currently registered
Since:
1.4
See Also:
addActionListener(java.awt.event.ActionListener) sample code for java.awt.List.addActionListener(java.awt.event.ActionListener) definition code for java.awt.List.addActionListener(java.awt.event.ActionListener) , removeActionListener(java.awt.event.ActionListener) sample code for java.awt.List.removeActionListener(java.awt.event.ActionListener) definition code for java.awt.List.removeActionListener(java.awt.event.ActionListener) , ActionEvent sample code for java.awt.event.ActionEvent definition code for java.awt.event.ActionEvent , ActionListener sample code for java.awt.event.ActionListener definition code for java.awt.event.ActionListener

getListeners sample code for java.awt.List.<T extends java.util.EventListener>getListeners(java.lang.Class<T>) definition code for java.awt.List.<T extends java.util.EventListener>getListeners(java.lang.Class<T>)

public <T extends EventListener sample code for java.util.EventListener definition code for java.util.EventListener > T[] getListeners(Class sample code for java.lang.Class definition code for java.lang.Class <T> listenerType)
Returns an array of all the objects currently registered as FooListeners upon this List. FooListeners are registered using the addFooListener method.

You can specify the listenerType argument with a class literal, such as FooListener.class. For example, you can query a List l for its item listeners with the following code:

ItemListener[] ils = (ItemListener[])(l.getListeners(ItemListener.class));
If no such listeners exist, this method returns an empty array.

Overrides:
getListeners sample code for java.awt.Component.getListeners(java.lang.Class) definition code for java.awt.Component.getListeners(java.lang.Class) in class Component sample code for java.awt.Component definition code for java.awt.Component
Parameters:
listenerType - the type of listeners requested; this parameter should specify an interface that descends from java.util.EventListener
Returns:
an array of all objects registered as FooListeners on this list, or an empty array if no such listeners have been added
Throws:
ClassCastException sample code for java.lang.ClassCastException definition code for java.lang.ClassCastException - if listenerType doesn't specify a class or interface that implements java.util.EventListener
Since:
1.3
See Also:
getItemListeners() sample code for java.awt.List.getItemListeners() definition code for java.awt.List.getItemListeners()

processEvent sample code for java.awt.List.processEvent(java.awt.AWTEvent) definition code for java.awt.List.processEvent(java.awt.AWTEvent)

protected void processEvent(AWTEvent sample code for java.awt.AWTEvent definition code for java.awt.AWTEvent  e)
Processes events on this scrolling list. If an event is an instance of ItemEvent, it invokes the processItemEvent method. Else, if the event is an instance of ActionEvent, it invokes processActionEvent. If the event is not an item event or an action event, it invokes processEvent on the superclass.

Note that if the event parameter is null the behavior is unspecified and may result in an exception.

Overrides:
processEvent sample code for java.awt.Component.processEvent(java.awt.AWTEvent) definition code for java.awt.Component.processEvent(java.awt.AWTEvent) in class Component sample code for java.awt.Component definition code for java.awt.Component
Parameters:
e - the event
Since:
JDK1.1
See Also:
ActionEvent sample code for java.awt.event.ActionEvent definition code for java.awt.event.ActionEvent , ItemEvent sample code for java.awt.event.ItemEvent definition code for java.awt.event.ItemEvent , processActionEvent(java.awt.event.ActionEvent) sample code for java.awt.List.processActionEvent(java.awt.event.ActionEvent) definition code for java.awt.List.processActionEvent(java.awt.event.ActionEvent) , processItemEvent(java.awt.event.ItemEvent) sample code for java.awt.List.processItemEvent(java.awt.event.ItemEvent) definition code for java.awt.List.processItemEvent(java.awt.event.ItemEvent)

processItemEvent sample code for java.awt.List.processItemEvent(java.awt.event.ItemEvent) definition code for java.awt.List.processItemEvent(java.awt.event.ItemEvent)

protected void processItemEvent(ItemEvent sample code for java.awt.event.ItemEvent definition code for java.awt.event.ItemEvent  e)
Processes item events occurring on this list by dispatching them to any registered ItemListener objects.

This method is not called unless item events are enabled for this component. Item events are enabled when one of the following occurs:

Note that if the event parameter is null the behavior is unspecified and may result in an exception.

Parameters:
e - the item event
Since:
JDK1.1
See Also:
ItemEvent sample code for java.awt.event.ItemEvent definition code for java.awt.event.ItemEvent , ItemListener sample code for java.awt.event.ItemListener definition code for java.awt.event.ItemListener , addItemListener(java.awt.event.ItemListener) sample code for java.awt.List.addItemListener(java.awt.event.ItemListener) definition code for java.awt.List.addItemListener(java.awt.event.ItemListener) , Component.enableEvents(long) sample code for java.awt.Component.enableEvents(long) definition code for java.awt.Component.enableEvents(long)

processActionEvent sample code for java.awt.List.processActionEvent(java.awt.event.ActionEvent) definition code for java.awt.List.processActionEvent(java.awt.event.ActionEvent)

protected void processActionEvent(ActionEvent sample code for java.awt.event.ActionEvent definition code for java.awt.event.ActionEvent  e)
Processes action events occurring on this component by dispatching them to any registered ActionListener objects.

This method is not called unless action events are enabled for this component. Action events are enabled when one of the following occurs:

Note that if the event parameter is null the behavior is unspecified and may result in an exception.

Parameters:
e - the action event
Since:
JDK1.1
See Also:
ActionEvent sample code for java.awt.event.ActionEvent definition code for java.awt.event.ActionEvent , ActionListener sample code for java.awt.event.ActionListener definition code for java.awt.event.ActionListener , addActionListener(java.awt.event.ActionListener) sample code for java.awt.List.addActionListener(java.awt.event.ActionListener) definition code for java.awt.List.addActionListener(java.awt.event.ActionListener) , Component.enableEvents(long) sample code for java.awt.Component.enableEvents(long) definition code for java.awt.Component.enableEvents(long)

paramString sample code for java.awt.List.paramString() definition code for java.awt.List.paramString()

protected String sample code for java.lang.String definition code for java.lang.String  paramString()
Returns the parameter string representing the state of this scrolling list. This string is useful for debugging.

Overrides:
paramString sample code for java.awt.Component.paramString() definition code for java.awt.Component.paramString() in class Component sample code for java.awt.Component definition code for java.awt.Component
Returns:
the parameter string of this scrolling list

delItems sample code for java.awt.List.delItems(int, int) definition code for java.awt.List.delItems(int, int)

@Deprecated
public void delItems(int start,
                                int end)
Deprecated. As of JDK version 1.1, Not for public use in the future. This method is expected to be retained only as a package private method.


getAccessibleContext sample code for java.awt.List.getAccessibleContext() definition code for java.awt.List.getAccessibleContext()

public AccessibleContext sample code for javax.accessibility.AccessibleContext definition code for javax.accessibility.AccessibleContext  getAccessibleContext()
Gets the AccessibleContext associated with this List. For lists, the AccessibleContext takes the form of an AccessibleAWTList. A new AccessibleAWTList 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 java.awt.Component.getAccessibleContext() definition code for java.awt.Component.getAccessibleContext() in class Component sample code for java.awt.Component definition code for java.awt.Component
Returns:
an AccessibleAWTList that serves as the AccessibleContext of this List