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.

Constructor Index

 o Choice()
Constructs a new Choice.

Method Index

 o addItem(String)
Adds an item to this Choice.
 o addNotify()
Creates the Choice's peer.
 o countItems()
Returns the number of items in this Choice.
 o getItem(int)
Returns the String at the specified index in the Choice.
 o getSelectedIndex()
Returns the index of the currently selected item.
 o getSelectedItem()
Returns a String representation of the current choice.
 o paramString()
Returns the parameter String of this Choice.
 o select(int)
Selects the item with the specified postion.
 o select(String)
Selects the item with the specified String.

Constructors

 o Choice
public Choice()
Constructs a new Choice.

Methods

 o 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
 o countItems
public int countItems()
Returns the number of items in this Choice.
See Also:
getItem
 o 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
 o 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.
 o getSelectedItem
public String getSelectedItem()
Returns a String representation of the current choice.
See Also:
getSelectedIndex
 o getSelectedIndex
public int getSelectedIndex()
Returns the index of the currently selected item.
See Also:
getSelectedItem
 o 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
 o select
public void select(String str)
Selects the item with the specified String.
Parameters:
str - the specified String
See Also:
getSelectedItem, getSelectedIndex
 o 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