Class java.awt.Choice
All Packages Class Hierarchy This Package Previous Next Index
Class java.awt.Choice
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Choice
- public class Choice
- extends Component
The Choice class is a pop-up menu of choices. The current choice is
displayed as the title of the menu.
- Choice()
- Constructs a new Choice.
- addItem(String)
- Adds an item to this Choice.
- addNotify()
- Creates the Choice's peer.
- countItems()
- Returns the number of items in this Choice.
- getItem(int)
- Returns the String at the specified index in the Choice.
- getSelectedIndex()
- Returns the index of the currently selected item.
- getSelectedItem()
- Returns a String representation of the current choice.
- paramString()
- Returns the parameter String of this Choice.
- select(int)
- Selects the item with the specified postion.
- select(String)
- Selects the item with the specified String.
Choice
public Choice()
- Constructs a new Choice.
addNotify
public synchronized void addNotify()
- Creates the Choice's peer. This peer allows us to change the look
of the Choice without changing its functionality.
- Overrides:
- addNotify in class Component
countItems
public int countItems()
- Returns the number of items in this Choice.
- See Also:
- getItem
getItem
public String getItem(int index)
- Returns the String at the specified index in the Choice.
- Parameters:
- index - the index at which to begin
- See Also:
- countItems
addItem
public synchronized void addItem(String item)
- Adds an item to this Choice.
- Parameters:
- item - the item to be added
- Throws: NullPointerException
- If the item's value is equal to null.
getSelectedItem
public String getSelectedItem()
- Returns a String representation of the current choice.
- See Also:
- getSelectedIndex
getSelectedIndex
public int getSelectedIndex()
- Returns the index of the currently selected item.
- See Also:
- getSelectedItem
select
public synchronized void select(int pos)
- Selects the item with the specified postion.
- Parameters:
- pos - the choice item position
- Throws: IllegalArgumentException
- If the choice item position is invalid.
- See Also:
- getSelectedItem, getSelectedIndex
select
public void select(String str)
- Selects the item with the specified String.
- Parameters:
- str - the specified String
- See Also:
- getSelectedItem, getSelectedIndex
paramString
protected String paramString()
- Returns the parameter String of this Choice.
- Overrides:
- paramString in class Component
All Packages Class Hierarchy This Package Previous Next Index