|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjcontrol.ui.wombat.Component
jcontrol.ui.wombat.AbstractFocusComponent
jcontrol.ui.wombat.AbstractScrolledComponent
jcontrol.ui.wombat.ComboBox
public class ComboBox
The class ComboBox
implements a choice user interface object.
Use the select-, up- and down-keys on the keyboard or the touch screen to open
the combo box and to select an item.
ActionEvent
of type ActionEvent.ITEM_SELECTED
is fired.
(c) Copyright 2005-2007 DOMOLOGIC GmbH
Field Summary |
---|
Fields inherited from interface jcontrol.ui.wombat.IFocusable |
---|
TRANSFER_FOCUS_BACKWARD, TRANSFER_FOCUS_FORWARD |
Fields inherited from interface jcontrol.ui.wombat.event.TouchListener |
---|
RESULT_ACCEPTED, RESULT_EXECUTED, RESULT_NONE |
Constructor Summary | |
---|---|
ComboBox(int x,
int y,
int width)
Constructs a new empty ComboBox at the given
x- and y-coordinates. |
|
ComboBox(java.lang.String[] items,
int x,
int y,
int width)
Constructs a new ComboBox with a list of items
at the given x- and y-coordinates with the specified width and height. |
Method Summary | |
---|---|
void |
add(java.lang.String item)
Adds an item to this ComboBox . |
int |
getSelectedIndex()
Returns the currently selected index. |
java.lang.String |
getSelectedItem()
Returns the currently selected item |
KeyEvent |
onKeyEvent(KeyEvent e)
Handle key events. |
int |
onTouchEvent(TouchEvent e)
If a TouchEvent accurs, this method is called. |
void |
paint(jcontrol.graphics.XGraphics g)
Paint this ComboBox . |
boolean |
remove(java.lang.String item)
Removes the first occurrence of item from the ComboBox . |
void |
setItems(java.lang.String[] items)
Sets/resets the list of items in this ComboBox. |
java.lang.String |
setSelection(int index)
Selects the item at the given zero-relative index in the receiver's list. |
Methods inherited from class jcontrol.ui.wombat.AbstractFocusComponent |
---|
getActionListener, requestFocus, setActionListener, setEnabled, setVisible |
Methods inherited from class jcontrol.ui.wombat.Component |
---|
getFrame, isEnabled, isVisible, repaint, repaintAll, safeExec, setBackgroundColor, setBounds, setDirty, setFont, setForegroundColor, setRedraw, setTransparentColor, unsafeExec, update |
Methods inherited from class java.lang.Object |
---|
equals, getClass, notifyAll, toString, wait |
Constructor Detail |
---|
public ComboBox(int x, int y, int width)
ComboBox
at the given
x- and y-coordinates. The preferred width and height is
internally computed by taking the contained items dimensions.
x
- The x-coordinate of this ComboBox
.y
- The y-coordinate of this ComboBox
.width
- The preferred width of this ComboBox
.
The ComboBox is enlarged if the text width exceeds this value.public ComboBox(java.lang.String[] items, int x, int y, int width)
ComboBox
with a list of items
at the given x- and y-coordinates with the specified width and height.
items
- An array of text-items.x
- The x-coordinate of this ComboBox
.y
- The y-coordinate of this ComboBox
.width
- The width of this ComboBox
.Method Detail |
---|
public void add(java.lang.String item)
ComboBox
.
item
- The item to add to the ComboBox
.public int getSelectedIndex()
public java.lang.String getSelectedItem()
public KeyEvent onKeyEvent(KeyEvent e)
ActionEvent
is fired.
onKeyEvent
in interface KeyListener
onKeyEvent
in class AbstractFocusComponent
e
- the event that contains information about the key.
null
if the KeyEvent has been consumed by the KeyListener,public int onTouchEvent(TouchEvent e)
onTouchEvent
in interface TouchListener
onTouchEvent
in class AbstractFocusComponent
e
- the TouchEvent.
RESULT_ACCEPTED
if the TouchEvent has been consumed by the TouchListener,RESULT_EXECUTED
if the TouchEvent has been consumed by the TouchListener and some important action has been performed, e.g. an action event has been invoked,RESULT_NONE
if the TouchEvent should be passed on to the next TouchListener.public void paint(jcontrol.graphics.XGraphics g)
ComboBox
. Don't call this method directly.
paint
in class Component
g
- the application's graphics object.public boolean remove(java.lang.String item)
item
from the ComboBox
.
item
- The item to remove from the ComboBox
.
public void setItems(java.lang.String[] items)
items
- the new item list.public java.lang.String setSelection(int index)
index
- the index of the item to select
null
if the index is out of range or the ComboBox was open and therefore, the item could not be selected.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |