|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Choice
The Choice class is a pop-up menu of choices. The current choice is displayed as the title of the menu.
Field Summary |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
Choice()
Constructs a new Choice. |
Method Summary | |
void |
addItem(String item)
Adds an item to this Choice. |
void |
addNotify()
Creates the Choice's peer. |
int |
countItems()
Returns the number of items in this Choice. |
String |
getItem(int index)
Returns the String at the specified index in the Choice. |
int |
getSelectedIndex()
Returns the index of the currently selected item. |
String |
getSelectedItem()
Returns a String representation of the current choice. |
protected String |
paramString()
Returns the parameter String of this Choice. |
void |
select(int pos)
Selects the item with the specified postion. |
void |
select(String str)
Selects the item with the specified String. |
Methods inherited from class java.awt.Component |
action, bounds, checkImage, checkImage, createImage, createImage, deliverEvent, disable, enable, enable, getBackground, getColorModel, getFont, getFontMetrics, getForeground, getGraphics, getParent, getPeer, getToolkit, gotFocus, handleEvent, hide, imageUpdate, inside, invalidate, isEnabled, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, removeNotify, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setFont, setForeground, show, show, size, toString, update, validate |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Choice()
Method Detail |
public void addNotify()
addNotify
in class Component
Component.getPeer()
,
Component.removeNotify()
public int countItems()
getItem(int)
public String getItem(int index)
index
- the index at which to begincountItems()
public void addItem(String item)
item
- the item to be added
NullPointerException
- If the item's value is equal to null.public String getSelectedItem()
getSelectedIndex()
public int getSelectedIndex()
getSelectedItem()
public void select(int pos)
pos
- the choice item position
IllegalArgumentException
- If the choice item position is
invalid.getSelectedItem()
,
getSelectedIndex()
public void select(String str)
str
- the specified StringgetSelectedItem()
,
getSelectedIndex()
protected String paramString()
paramString
in class Component
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |