java.awt
Class List

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.List
All Implemented Interfaces:
Accessible, java.awt.image.ImageObserver, ItemSelectable, MenuContainer, Serializable

public class List
extends Component
implements ItemSelectable, Accessible

Unsafe:

See Also:
Serialized Form

Field Summary
(package private)  ActionListener actionListener
           
private static String base
           
(package private) static int DEFAULT_VISIBLE_ROWS
          The default number of visible rows is 4.
(package private)  ItemListener itemListener
           
(package private)  Vector items
          A vector created to contain items which will become part of the List Component.
private  int listSerializedDataVersion
          The List component's Serialized Data Version.
(package private)  boolean multipleMode
          multipleMode is a variable that will be set to true if a list component is to be set to multiple selection mode, that is where the user can select more than one item in a list at one time.
private static int nameCounter
           
(package private)  int rows
          This field will represent the number of visible rows in the List Component.
(package private)  int[] selected
          selected is an array that will contain the indices of items that have been selected.
private static long serialVersionUID
           
(package private)  int visibleIndex
          This variable contains the value that will be used when trying to make a particular list item visible.
 
Fields inherited from class java.awt.Component
accessibleContext, actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, bufferStrategy, CENTER_ALIGNMENT, componentListener, componentListenerK, componentOrientation, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, focusTraversalKeys, font, foreground, graphicsConfig, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, ignoreRepaint, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, mouseWheelListener, mouseWheelListenerK, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowFocusListenerK, windowListenerK, windowStateListenerK, x, y
 
Constructor Summary
List()
          Suppressed: Creates a new scrolling list.
List(int rows)
          Suppressed: Creates a new scrolling list initialized with the specified number of visible lines.
List(int rows, boolean multipleMode)
          Suppressed: Creates a new scrolling list initialized to display the specified number of rows.
 
Method Summary
 void add(String item)
          Suppressed: Adds the specified item to the end of scrolling list.
 void add(String item, int index)
          Suppressed: Adds the specified item to the the scrolling list at the position indicated by the index.
 void addActionListener(ActionListener l)
          Suppressed: Adds the specified action listener to receive action events from this list.
 void addItem(String item)
          Suppressed: @deprecated replaced by add(String).
 void addItem(String item, int index)
          Suppressed: @deprecated replaced by add(String, int).
 void addItemListener(ItemListener l)
          Suppressed: Adds the specified item listener to receive item events from this list.
 void addNotify()
          Suppressed: Creates the peer for the list.
 boolean allowsMultipleSelections()
          Suppressed: @deprecated As of JDK version 1.1, replaced by isMultipleMode().
 void clear()
          Suppressed: @deprecated As of JDK version 1.1, replaced by removeAll().
(package private)  String constructComponentName()
          Construct a name for this component.
 int countItems()
          Suppressed: @deprecated As of JDK version 1.1, replaced by getItemCount().
 void delItem(int position)
          Suppressed: @deprecated replaced by remove(String) and remove(int).
 void delItems(int start, int end)
          Suppressed: @deprecated As of JDK version 1.1, Not for public use in the future.
 void deselect(int index)
          Suppressed: Deselects the item at the specified index.
(package private)  boolean eventEnabled(AWTEvent e)
           
 AccessibleContext getAccessibleContext()
          Suppressed: Gets the AccessibleContext associated with this List.
 ActionListener[] getActionListeners()
          Suppressed: Returns an array of all the action listeners registered on this list.
 String getItem(int index)
          Suppressed: Gets the item associated with the specified index.
 int getItemCount()
          Suppressed: Gets the number of items in the list.
(package private)  String getItemImpl(int index)
           
 ItemListener[] getItemListeners()
          Suppressed: Returns an array of all the item listeners registered on this list.
 String[] getItems()
          Suppressed: Gets the items in the list.
 EventListener[] getListeners(Class listenerType)
          Suppressed: Returns an array of all the objects currently registered as FooListeners upon this List.
 Dimension getMinimumSize()
          Suppressed: Determines the minimum size of this scrolling list.
 Dimension getMinimumSize(int rows)
          Suppressed: Gets the minumum dimensions for a list with the specified number of rows.
 Dimension getPreferredSize()
          Suppressed: Gets the preferred size of this scrolling list.
 Dimension getPreferredSize(int rows)
          Suppressed: Gets the preferred dimensions for a list with the specified number of rows.
 int getRows()
          Suppressed: Gets the number of visible lines in this list.
 int getSelectedIndex()
          Suppressed: Gets the index of the selected item on the list,
 int[] getSelectedIndexes()
          Suppressed: Gets the selected indexes on the list.
 String getSelectedItem()
          Suppressed: Gets the selected item on this scrolling list.
 String[] getSelectedItems()
          Suppressed: Gets the selected items on this scrolling list.
 Object[] getSelectedObjects()
          Suppressed: Returns the selected items on the list in an array of objects.
 int getVisibleIndex()
          Suppressed: Gets the index of the item that was last made visible by the method makeVisible.
 boolean isIndexSelected(int index)
          Suppressed: Determines if the specified item in this scrolling list is selected.
 boolean isMultipleMode()
          Suppressed: Determines whether this list allows multiple selections.
 boolean isSelected(int index)
          Suppressed: @deprecated As of JDK version 1.1, replaced by isIndexSelected(int).
 void makeVisible(int index)
          Suppressed: Makes the item at the specified index visible.
 Dimension minimumSize()
          Suppressed: @deprecated As of JDK version 1.1, replaced by getMinimumSize().
 Dimension minimumSize(int rows)
          Suppressed: @deprecated As of JDK version 1.1, replaced by getMinimumSize(int).
protected  String paramString()
          Returns the parameter string representing the state of this scrolling list.
 Dimension preferredSize()
          Suppressed: @deprecated As of JDK version 1.1, replaced by getPreferredSize().
 Dimension preferredSize(int rows)
          Suppressed: @deprecated As of JDK version 1.1, replaced by getPreferredSize(int).
protected  void processActionEvent(ActionEvent e)
          Processes action events occurring on this component by dispatching them to any registered ActionListener objects.
protected  void processEvent(AWTEvent e)
          Processes events on this scrolling list.
protected  void processItemEvent(ItemEvent e)
          Processes item events occurring on this list by dispatching them to any registered ItemListener objects.
private  void readObject(ObjectInputStream s)
          Reads the ObjectInputStream and if it isn't null adds a listener to receive both item events and action events (as specified by the key stored in the stream) fired by the List.
 void remove(int position)
          Suppressed: Remove the item at the specified position from this scrolling list.
 void remove(String item)
          Suppressed: Removes the first occurrence of an item from the list.
 void removeActionListener(ActionListener l)
          Suppressed: Removes the specified action listener so that it no longer receives action events from this list.
 void removeAll()
          Suppressed: Removes all items from this list.
 void removeItemListener(ItemListener l)
          Suppressed: Removes the specified item listener so that it no longer receives item events from this list.
 void removeNotify()
          Suppressed: Removes the peer for this list.
 void replaceItem(String newValue, int index)
          Suppressed: Replaces the item at the specified index in the scrolling list with the new string.
 void select(int index)
          Suppressed: Selects the item at the specified index in the scrolling list.
 void setMultipleMode(boolean b)
          Suppressed: Sets the flag that determines whether this list allows multiple selections.
 void setMultipleSelections(boolean b)
          Suppressed: @deprecated As of JDK version 1.1, replaced by setMultipleMode(boolean).
private  void writeObject(ObjectOutputStream s)
          Writes default serializable fields to stream.
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, adjustListeningChildrenOnParent, applyComponentOrientation, areFocusTraversalKeysSet, areInputMethodsEnabled, autoProcessMouseWheel, autoTransferFocus, bounds, checkGD, checkImage, checkImage, checkWindowClosingException, clearCurrentFocusCycleRootOnHide, clearMostRecentFocusOwnerOnHide, coalesceEvents, contains, contains, containsFocus, countHierarchyMembers, createBufferStrategy, createBufferStrategy, createChildHierarchyEvents, createHierarchyEvents, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, dispatchEventImpl, dispatchMouseWheelToAncestor, doLayout, enable, enable, enableEvents, enableInputMethods, eventTypeEnabled, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getAlignmentX, getAlignmentY, getBackBuffer, getBackground, getBounds, getBounds, getBufferStrategy, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys_NoIDCheck, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getMaximumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getToolkitImpl, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, initializeFocusTraversalKeys, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFocusTraversableOverridden, isFontSet, isForegroundSet, isLightweight, isOpaque, isRecursivelyVisible, isShowing, isValid, isVisible, iterate, keyDown, keyUp, layout, lightweightPaint, lightweightPrint, list, list, list, list, list, locate, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, nextFocusHelper, numListening, paint, paintAll, paintHeavyweightComponents, postEvent, postsOldMouseEvents, prepareImage, prepareImage, print, printAll, printHeavyweightComponents, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusHelper, requestFocusInWindow, requestFocusInWindow, resetGC, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys_NoIDCheck, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setGCFromPeer, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocus, transferFocusBackward, transferFocusUpCycle, update, updateCursorImmediately, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

items

Vector items
A vector created to contain items which will become part of the List Component.

See Also:
addItem(), getItem()

rows

int rows
This field will represent the number of visible rows in the List Component. It is specified only once, and that is when the list component is actually created. It will never change.

See Also:
getRows()

multipleMode

boolean multipleMode
multipleMode is a variable that will be set to true if a list component is to be set to multiple selection mode, that is where the user can select more than one item in a list at one time. multipleMode will be set to false if the list component is set to single selection, that is where the user can only select one item on the list at any one time.

See Also:
isMultipleMode(), setMultipleMode()

selected

int[] selected
selected is an array that will contain the indices of items that have been selected.

See Also:
getSelectedIndexes(), getSelectedIndex()

visibleIndex

int visibleIndex
This variable contains the value that will be used when trying to make a particular list item visible.

See Also:
makeVisible()

actionListener

transient ActionListener actionListener

itemListener

transient ItemListener itemListener

base

private static final String base

nameCounter

private static int nameCounter

serialVersionUID

private static final long serialVersionUID

DEFAULT_VISIBLE_ROWS

static final int DEFAULT_VISIBLE_ROWS
The default number of visible rows is 4. A list with zero rows is unusable and unsightly.


listSerializedDataVersion

private int listSerializedDataVersion
The List component's Serialized Data Version.

Constructor Detail

List

public List()
     throws HeadlessException
Suppressed: 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.

See Also:
java.awt.GraphicsEnvironment#isHeadless

List

public List(int rows)
     throws HeadlessException
Suppressed: 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.
Since:
JDK1.1
See Also:
java.awt.GraphicsEnvironment#isHeadless

List

public List(int rows,
            boolean multipleMode)
     throws HeadlessException
Suppressed: 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.
See Also:
java.awt.GraphicsEnvironment#isHeadless
Method Detail

constructComponentName

String constructComponentName()
Construct a name for this component. Called by getName when the name is null.

Overrides:
constructComponentName in class Component

addNotify

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

Overrides:
addNotify in class Component
See Also:
Component.isDisplayable(), Component.removeNotify()

removeNotify

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

Overrides:
removeNotify in class Component
See Also:
Component.isDisplayable(), Component.addNotify()

getItemCount

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

Returns:
the number of items in the list
Since:
JDK1.1
See Also:
getItem(int)

countItems

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


getItem

public String getItem(int index)
Suppressed: 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()

getItemImpl

final String getItemImpl(int index)

getItems

public String[] getItems()
Suppressed: Gets the items in the list.

Returns:
a string array containing items of the list
Since:
JDK1.1
See Also:
select(int), deselect(int), isIndexSelected(int)

add

public void add(String item)
Suppressed: Adds the specified item to the end of scrolling list.

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

addItem

public void addItem(String item)
Suppressed: @deprecated replaced by add(String).


add

public void add(String item,
                int index)
Suppressed: 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

public void addItem(String item,
                    int index)
Suppressed: @deprecated replaced by add(String, int).


replaceItem

public void replaceItem(String newValue,
                        int index)
Suppressed: 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

removeAll

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

Since:
JDK1.1
See Also:
remove(java.lang.String), delItems(int, int)

clear

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


remove

public void remove(String item)
Suppressed: Removes the first occurrence of an item from the list.

Parameters:
item - the item to remove from the list
Since:
JDK1.1

remove

public void remove(int position)
Suppressed: Remove the item at the specified position from this scrolling list.

Parameters:
position - the index of the item to delete
Since:
JDK1.1
See Also:
add(String, int)

delItem

public void delItem(int position)
Suppressed: @deprecated replaced by remove(String) and remove(int).


getSelectedIndex

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

Returns:
the index of the selected item, or -1 if no item is selected, or if more that one item is selected
See Also:
select(int), deselect(int), isIndexSelected(int)

getSelectedIndexes

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

Returns:
an array of the selected indexes of this scrolling list; if no items are selected, a zero-length array is returned
See Also:
select(int), deselect(int), isIndexSelected(int)

getSelectedItem

public String getSelectedItem()
Suppressed: Gets the selected item on this scrolling list.

Returns:
the selected item on the list, or null if no item is selected
See Also:
select(int), deselect(int), isIndexSelected(int)

getSelectedItems

public String[] getSelectedItems()
Suppressed: Gets the selected items on this scrolling list.

Returns:
an array of the selected items on this scrolling list
See Also:
select(int), deselect(int), isIndexSelected(int)

getSelectedObjects

public Object[] getSelectedObjects()
Suppressed: Returns the selected items on the list in an array of objects.

Specified by:
getSelectedObjects in interface ItemSelectable
See Also:
ItemSelectable

select

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

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(), deselect(int), isIndexSelected(int)

deselect

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

If the item at the specified index is not selected, or if the index is out of range, then the operation is ignored.

Parameters:
index - the position of the item to deselect
See Also:
select(int), getSelectedItem(), isIndexSelected(int)

isIndexSelected

public boolean isIndexSelected(int index)
Suppressed: 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), deselect(int)

isSelected

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


getRows

public int getRows()
Suppressed: 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

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

Returns:
true if this list allows multiple selections; otherwise, false
Since:
JDK1.1
See Also:
setMultipleMode(boolean)

allowsMultipleSelections

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


setMultipleMode

public void setMultipleMode(boolean b)
Suppressed: Sets the flag that determines whether this list allows multiple selections.

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()

setMultipleSelections

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


getVisibleIndex

public int getVisibleIndex()
Suppressed: 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)

makeVisible

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

Parameters:
index - the position of the item
See Also:
getVisibleIndex()

getPreferredSize

public Dimension getPreferredSize(int rows)
Suppressed: 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:
java.awt.Component#getPreferredSize

preferredSize

public Dimension preferredSize(int rows)
Suppressed: @deprecated As of JDK version 1.1, replaced by getPreferredSize(int).


getPreferredSize

public Dimension getPreferredSize()
Suppressed: Gets the preferred size of this scrolling list.

Overrides:
getPreferredSize in class Component
Returns:
the preferred dimensions for displaying this scrolling list
Since:
JDK1.1
See Also:
java.awt.Component#getPreferredSize

preferredSize

public Dimension preferredSize()
Suppressed: @deprecated As of JDK version 1.1, replaced by getPreferredSize().

Overrides:
preferredSize in class Component

getMinimumSize

public Dimension getMinimumSize(int rows)
Suppressed: 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:
java.awt.Component#getMinimumSize

minimumSize

public Dimension minimumSize(int rows)
Suppressed: @deprecated As of JDK version 1.1, replaced by getMinimumSize(int).


getMinimumSize

public Dimension getMinimumSize()
Suppressed: Determines the minimum size of this scrolling list.

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

minimumSize

public Dimension minimumSize()
Suppressed: @deprecated As of JDK version 1.1, replaced by getMinimumSize().

Overrides:
minimumSize in class Component

addItemListener

public void addItemListener(ItemListener l)
Suppressed: 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 in interface ItemSelectable
Parameters:
l - the item listener
Since:
JDK1.1
See Also:
removeItemListener(java.awt.event.ItemListener), getItemListeners(), select(int), deselect(int), java.awt.event.ItemEvent, java.awt.event.ItemListener

removeItemListener

public void removeItemListener(ItemListener l)
Suppressed: 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 in interface ItemSelectable
Parameters:
l - the item listener
Since:
JDK1.1
See Also:
addItemListener(java.awt.event.ItemListener), getItemListeners(), java.awt.event.ItemEvent, java.awt.event.ItemListener

getItemListeners

public ItemListener[] getItemListeners()
Suppressed: 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), removeItemListener(java.awt.event.ItemListener), java.awt.event.ItemEvent, java.awt.event.ItemListener

addActionListener

public void addActionListener(ActionListener l)
Suppressed: Adds the specified action listener to receive 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:
removeActionListener(java.awt.event.ActionListener), getActionListeners(), java.awt.event.ActionEvent, java.awt.event.ActionListener

removeActionListener

public void removeActionListener(ActionListener l)
Suppressed: 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), getActionListeners(), java.awt.event.ActionEvent, java.awt.event.ActionListener

getActionListeners

public ActionListener[] getActionListeners()
Suppressed: 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), removeActionListener(java.awt.event.ActionListener), java.awt.event.ActionEvent, java.awt.event.ActionListener

getListeners

public EventListener[] getListeners(Class listenerType)
Suppressed: 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 in class 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
Since:
1.3
See Also:
getItemListeners()

eventEnabled

boolean eventEnabled(AWTEvent e)
Overrides:
eventEnabled in class Component

processEvent

protected void processEvent(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 in class Component
Parameters:
e - the event
Since:
JDK1.1
See Also:
java.awt.event.ActionEvent, java.awt.event.ItemEvent, processActionEvent(java.awt.event.ActionEvent), processItemEvent(java.awt.event.ItemEvent)

processItemEvent

protected void processItemEvent(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:
java.awt.event.ItemEvent, java.awt.event.ItemListener, addItemListener(java.awt.event.ItemListener), java.awt.Component#enableEvents

processActionEvent

protected void processActionEvent(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:
java.awt.event.ActionEvent, java.awt.event.ActionListener, addActionListener(java.awt.event.ActionListener), java.awt.Component#enableEvents

paramString

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

Overrides:
paramString in class Component
Returns:
the parameter string of this scrolling list

delItems

public void delItems(int start,
                     int end)
Suppressed: @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.


writeObject

private void writeObject(ObjectOutputStream s)
                  throws IOException
Writes default serializable fields to stream. Writes a list of serializable ItemListeners and ActionListeners as optional data. The non-serializable listeners are detected and no attempt is made to serialize them.

Parameters:
s - the ObjectOutputStream to write
IOException
See Also:
AWTEventMulticaster.save(ObjectOutputStream, String, EventListener), java.awt.Component.itemListenerK, java.awt.Component.actionListenerK, readObject(java.io.ObjectInputStream)

readObject

private void readObject(ObjectInputStream s)
                 throws ClassNotFoundException,
                        IOException,
                        HeadlessException
Reads the ObjectInputStream and if it isn't null adds a listener to receive both item events and action events (as specified by the key stored in the stream) fired by the List. Unrecognized keys or values will be ignored.

Parameters:
s - the ObjectInputStream to write
ClassNotFoundException
IOException
HeadlessException
See Also:
removeActionListener(), addActionListener(), java.awt.GraphicsEnvironment#isHeadless, writeObject(java.io.ObjectOutputStream)

getAccessibleContext

public AccessibleContext getAccessibleContext()
Suppressed: 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 in interface Accessible
Overrides:
getAccessibleContext in class Component
Returns:
an AccessibleAWTList that serves as the AccessibleContext of this List


comments?