|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jcontrol.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 class jcontrol.ui.wombat.AbstractScrolledComponent |
---|
m_fontHeight, m_scrollBarSize, m_scrollValue |
Fields inherited from class jcontrol.ui.wombat.AbstractFocusComponent |
---|
BORDER_WIDTH, listener |
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(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(String item)
Adds an item to this ComboBox . |
int |
getSelectedIndex()
Returns the currently selected index. |
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(XGraphics g)
Paint this ComboBox . |
boolean |
remove(String item)
Removes the first occurrence of item from the ComboBox . |
void |
setItems(String[] items)
Sets/resets the list of items in this ComboBox. |
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.AbstractScrolledComponent |
---|
drawScrollBar |
Methods inherited from class jcontrol.ui.wombat.AbstractFocusComponent |
---|
clearCorners, drawBevelRect, drawButton, drawDottedRect, drawFocusRect, getActionListener, onActionEvent, requestFocus, setActionListener, setEnabled, setVisible |
Methods inherited from class jcontrol.ui.wombat.Component |
---|
drawDisabledImage, getFrame, isEnabled, isVisible, isVisibleInternal, redrawInternalAndParent, repaint, repaintAll, safeExec, setBackgroundColor, setBackgroundColorInternal, setBounds, setDirty, setFont, setForegroundColor, setForegroundColorInternal, setParametersInternal, setRedraw, setTransparentColor, unsafeExec, update |
Methods inherited from class java.lang.Object |
---|
clone, 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(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 setItems(String[] items)
items
- the new item list.public void add(String item)
ComboBox
.
item
- The item to add to the ComboBox
.public boolean remove(String item)
item
from the ComboBox
.
item
- The item to remove from the ComboBox
.
public void paint(XGraphics g)
ComboBox
. Don't call this method directly.
paint
in class Component
g
- the application's graphics object.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 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.public String getSelectedItem()
public int getSelectedIndex()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |