The Choice is a Component that provides a drop-down list of choices to choose from.
public class java.awt.Choice extends java.awt.Component implements java.awt.ItemSelectable { // Constructors public Choice(); // Instance Methods public synchronized void add (String item); public synchronized void addItem (String item); public void addItemListener (ItemListener l); public void addNotify(); public int countItems(); public String getItem (int index); public int getItemCount(); public int getSelectedIndex(); public synchronized String getSelectedItem(); public synchronized Object[] getSelectedObjects(); public synchronized void insert (String item, int index); public synchronized void remove (int position); public synchronized void remove (String item); public synchronized void removeAll(); public void removeItemListener (ItemListener l); public synchronized void select (int pos); public synchronized void select (String str); // Protected Instance Methods protected String paramString(); protected void processEvent (AWTEvent e); protected void processItemEvent (ItemEvent e); }
Constructs a Choice object.
Text for new entry.
If item is null.
Adds a new entry to the available choices.
Text for new entry.
If item is null.
Replaced by add(String).
The listener to be added.
ItemSelectable.addItemListener(ItemListener l)
Adds a listener for the ItemEvent objects this Choice generates.
Component.addNotify()
Creates Choice's peer.
Number of items in the Choice.
Replaced by getItemCount().
Position of entry.
A string for an entry at a given position.
If index is invalid; indices start at zero.
Number of items in the Choice.
Position of currently selected entry.
Currently selected entry as a String.
ItemSelectable.getSelectedObjects()
A single-item array containing the current selection.
The string to add.
The position for the new string.
If index is less than zero.
Inserts item in the given position.
The index of an entry in the Choice component.
Removes the entry in the given position.
Text of an entry within the Choice component.
If string is not in the Choice.
Makes the first entry that matches string the selected item.
Removes all the entries from the Choice.
The listener to be removed.
ItemSelectable.removeItemListener (ItemListener l)
Removes the specified ItemListener so it will not receive ItemEvent objects from this Choice.
The index of an entry in the Choice component.
If the position is not valid.
Makes the entry in the given position.
Text of an entry within the Choice component.
Makes the first entry that matches str the selected item for the Choice.
A string with current settings of Choice.
Component.paramString()
Helper method for toString() to generate string of current settings.
The event to process.
Low level AWTEvents are passed to this method for processing.
The item event to process.
Item events are passed to this method for processing. Normally, this method is called by processEvent().
Component, ItemSelectable, String