|
|||||||||
| Home >> All >> java >> [ awt overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.awt
Class Choice

java.lang.Objectjava.awt.Component
java.awt.Choice
- All Implemented Interfaces:
- javax.accessibility.Accessible, java.awt.image.ImageObserver, ItemSelectable, MenuContainer, java.io.Serializable
- public class Choice
- extends Component
- implements ItemSelectable, java.io.Serializable, javax.accessibility.Accessible
- extends Component
This class implements a drop down choice list.
| Nested Class Summary | |
protected class |
Choice.AccessibleAWTChoice
This class provides accessibility support for the combo box. |
| Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy, Component.HeavyweightInLightweightListener |
| Field Summary | |
private java.awt.event.ItemListener |
item_listeners
|
(package private) java.util.Vector |
pItems
|
private int |
selectedIndex
|
private static long |
serialVersionUID
|
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
Choice()
Initializes a new instance of Choice. |
|
| Method Summary | |
void |
add(java.lang.String item)
Adds the specified item to this choice box. |
void |
addItem(java.lang.String item)
Adds the specified item to this choice box. |
void |
addItemListener(java.awt.event.ItemListener listener)
Adds the specified listener to the list of registered listeners for this object. |
void |
addNotify()
Creates the native peer for this object. |
int |
countItems()
Deprecated. This method is deprecated in favor of getItemCount. |
(package private) void |
dispatchEventImpl(AWTEvent e)
Implementation of dispatchEvent. |
javax.accessibility.AccessibleContext |
getAccessibleContext()
Gets the AccessibleContext associated with this Choice. |
java.lang.String |
getItem(int index)
Returns the item at the specified index in the list. |
int |
getItemCount()
Returns the number of items in the list. |
java.awt.event.ItemListener[] |
getItemListeners()
Returns all registered item listeners. |
java.util.EventListener[] |
getListeners(java.lang.Class listenerType)
Returns an array of all the objects currently registered as FooListeners upon this Choice. |
int |
getSelectedIndex()
Returns the index of the selected item. |
java.lang.String |
getSelectedItem()
Returns the currently selected item, or null if no item is selected. |
java.lang.Object[] |
getSelectedObjects()
Returns an array with one row containing the selected item. |
void |
insert(java.lang.String item,
int index)
Inserts an item into this Choice. |
protected java.lang.String |
paramString()
Returns a debugging string for this object. |
protected void |
processEvent(AWTEvent event)
Processes this event by invoking processItemEvent() if the
event is an instance of ItemEvent, otherwise the event
is passed to the superclass. |
protected void |
processItemEvent(java.awt.event.ItemEvent event)
Processes item event by dispatching to any registered listeners. |
void |
remove(int index)
Removes the item at the specified index from the choice box. |
void |
remove(java.lang.String item)
Removes the specified item from the choice box. |
void |
removeAll()
Removes all of the objects from this choice box. |
void |
removeItemListener(java.awt.event.ItemListener listener)
Removes the specified listener from the list of registered listeners for this object. |
void |
select(int index)
Forces the item at the specified index to be selected. |
void |
select(java.lang.String item)
Forces the named item to be selected. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
pItems
java.util.Vector pItems
selectedIndex
private int selectedIndex
item_listeners
private java.awt.event.ItemListener item_listeners
| Constructor Detail |
Choice
public Choice()
- Initializes a new instance of
Choice.
| Method Detail |
getItemCount
public int getItemCount()
- Returns the number of items in the list.
countItems
public int countItems()
- Deprecated. This method is deprecated in favor of
getItemCount.- Returns the number of items in the list.
- Returns the number of items in the list.
getItem
public java.lang.String getItem(int index)
- Returns the item at the specified index in the list.
add
public void add(java.lang.String item)
- Adds the specified item to this choice box.
- Since:
- 1.1
addItem
public void addItem(java.lang.String item)
- Adds the specified item to this choice box.
This method is oboslete since Java 2 platform 1.1. Please use @see add
instead.
insert
public void insert(java.lang.String item, int index)
- Inserts an item into this Choice. Existing items are shifted
upwards. If the new item is the only item, then it is selected.
If the currently selected item is shifted, then the first item is
selected. If the currently selected item is not shifted, then it
remains selected.
remove
public void remove(java.lang.String item)
- Removes the specified item from the choice box.
remove
public void remove(int index)
- Removes the item at the specified index from the choice box.
removeAll
public void removeAll()
- Removes all of the objects from this choice box.
getSelectedItem
public java.lang.String getSelectedItem()
- Returns the currently selected item, or null if no item is
selected.
getSelectedObjects
public java.lang.Object[] getSelectedObjects()
- Returns an array with one row containing the selected item.
- Specified by:
getSelectedObjectsin interfaceItemSelectable
getSelectedIndex
public int getSelectedIndex()
- Returns the index of the selected item.
select
public void select(int index)
- Forces the item at the specified index to be selected.
select
public void select(java.lang.String item)
- Forces the named item to be selected.
addNotify
public void addNotify()
addItemListener
public void addItemListener(java.awt.event.ItemListener listener)
- Adds the specified listener to the list of registered listeners for
this object.
- Specified by:
addItemListenerin interfaceItemSelectable
removeItemListener
public void removeItemListener(java.awt.event.ItemListener listener)
- Removes the specified listener from the list of registered listeners for
this object.
- Specified by:
removeItemListenerin interfaceItemSelectable
processEvent
protected void processEvent(AWTEvent event)
- Processes this event by invoking
processItemEvent()if the event is an instance ofItemEvent, otherwise the event is passed to the superclass.- Overrides:
processEventin classComponent
dispatchEventImpl
void dispatchEventImpl(AWTEvent e)
- Description copied from class:
Component - Implementation of dispatchEvent. Allows trusted package classes
to dispatch additional events first. This implementation first
translates
eto an AWT 1.0 event and sends the result toComponent.postEvent(java.awt.Event)55 . If the AWT 1.0 event is not handled, and events of typeeare enabled for this component, e is passed on toComponent.processEvent(java.awt.AWTEvent)55 .- Overrides:
dispatchEventImplin classComponent
processItemEvent
protected void processItemEvent(java.awt.event.ItemEvent event)
- Processes item event by dispatching to any registered listeners.
paramString
protected java.lang.String paramString()
- Returns a debugging string for this object.
- Overrides:
paramStringin classComponent
getListeners
public java.util.EventListener[] getListeners(java.lang.Class listenerType)
- Returns an array of all the objects currently registered as FooListeners
upon this Choice. FooListeners are registered using the addFooListener
method.
- Overrides:
getListenersin classComponent
- Since:
- 1.3
getItemListeners
public java.awt.event.ItemListener[] getItemListeners()
- Returns all registered item listeners.
- Since:
- 1.4
getAccessibleContext
public javax.accessibility.AccessibleContext getAccessibleContext()
- Gets the AccessibleContext associated with this
Choice. The context is created, if necessary.- Specified by:
getAccessibleContextin interfacejavax.accessibility.Accessible- Overrides:
getAccessibleContextin classComponent
|
|||||||||
| Home >> All >> java >> [ awt overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC