ListNameList
DescriptionThe List is a Component that provides a scrollable list of choices to select from. A List can be in one of two modes: single selection mode, in which only one item may be selected at a time; and multiple selection mode, in which several items may be selected at one time. A list does not necessarily display all of the choices at one time; one of the constructors lets you specify the number of choices to display simultaneously. Although the changes in 1.1 are extensive, almost all of them can be boiled down to (1) using the 1.1 event model, and (2) standardizing method names (e.g. set/get pairs). Class Definition
public class java.awt.List extends java.awt.Component implements java.awt.ItemSelectable { // Constructors public List(); public List (int rows); public List (int rows, boolean multipleSelections); // Instance Methods public void add (String item); public synchronized void add (String item, int index); public void addActionListener (ActionListener l); public void addItem (String item); public synchronized void addItem (String item, int index); public void addItemListener (ItemListener l); public void addNotify(); public boolean allowsMultipleSelections(); public synchronized void clear(); public int countItems(); public synchronized void delItem (int position); public synchronized void delItems (int start, int end); public synchronized void deselect (int index); public String getItem (int index); public int getItemCount(); public synchronized String[] getItems(); public Dimension getMinimumSize(); public Dimension getMinimumSize (int rows); public Dimension getPreferredSize(); public Dimension getPreferredSize (int rows); public int getRows(); public synchronized int getSelectedIndex(); public synchronized int[] getSelectedIndexes(); public synchronized String getSelectedItem(); public synchronized String[] getSelectedItems(); public Object[] getSelectedObjects(); public int getVisibleIndex(); public boolean isIndexSelected(int index); public boolean isMultipleMode(); public boolean isSelected (int index); public synchronized void makeVisible (int index); public Dimension minimumSize(); public Dimension minimumSize (int rows); public Dimension preferredSize(); public Dimension preferredSize (int rows); public synchronized void remove (int position); public synchronized void remove (String item); public void removeActionListener (ActionListener l); public synchronized void removeAll(); public void removeItemListener (ItemListener l); public void removeNotify(); public synchronized void replaceItem (String newItem, int index); public synchronized void select (int position); public synchronized void setMultipleMode (boolean b); public synchronized void setMultipleSelections (boolean value); // Protected Instance Methods protected String paramString(); protected void processActionEvent (ActionEvent e); protected void processEvent (AWTEvent e); protected void processItemEvent (ItemEvent e); } ConstructorsListpublic List()
public List (int rows)
public List (int rows, boolean multipleSelections)
Instance Methodsaddpublic void add (String item)
public synchronized void add (String item, int index)
addActionListenerpublic void addActionListener (ActionListener l)
addItempublic void addItem (String item)
public synchronized void addItem (String item, int index)
addItemListenerpublic void addItemListener (ItemListener l)
addNotifypublic void addNotify()
allowsMultipleSelectionspublic boolean allowsMultipleSelections()
clearpublic synchronized void clear()
countItemspublic int countItems()
delItempublic synchronized void delItem (int position)
delItemspublic synchronized void delItems (int start, int end)
deselectpublic synchronized void deselect (int index)
getItempublic String getItem (int index)
getItemCountpublic int getItemCount()
getItemspublic String[] getItems()
getMinimumSizepublic Dimension getMinimumSize()
public Dimension getMinimumSize (int rows)
getPreferredSizepublic Dimension getPreferredSize()
public Dimension getPreferredSize (int rows)
getRowspublic int getRows()
getSelectedIndexpublic synchronized int getSelectedIndex()
getSelectedIndexespublic synchronized int[] getSelectedIndexes()
getSelectedItempublic synchronized String getSelectedItem()
getSelectedItemspublic synchronized String[] getSelectedItems()
getSelectedObjectspublic Object[] getSelectedObjects()
getVisibleIndexpublic int getVisibleIndex()
isIndexSelectedpublic boolean isIndexSelected (int index)
isMultipleModepublic boolean isMultipleMode()
isSelectedpublic boolean isSelected (int index)
makeVisiblepublic synchronized void makeVisible (int index)
minimumSizepublic Dimension minimumSize()
public Dimension minimumSize (int rows)
preferredSizepublic Dimension preferredSize()
public Dimension preferredSize (int rows)
removepublic synchronized void remove (int position)
public synchronized void remove (String item)
removeActionListenerpublic void removeActionListener (ActionListener l)
removeAllpublic synchronized removeAll()
removeItemListenerpublic void removeItemListener (ItemListener l)
removeNotifypublic void removeNotify()
replaceItempublic synchronized void replaceItem (String newItem, int index)
selectpublic synchronized void select (int position)
setMultipleModepublic synchronized void setMultipleMode (boolean b)
setMultipleSelectionspublic synchronized void setMultipleSelections (boolean value)
Protected Instance MethodsparamStringprotected String paramString()
processActionEventprotected void processActionEvent (ActionEvent e)
processEventprotected void processEvent (AWTEvent e)
processItemEventprotected void processItemEvent(ItemEvent e)
See AlsoComponent, Dimension, ItemSelectable, String |
|