|
||||||||
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.ListBox
public class ListBox
Instances of this class represent a selectable user interface object that displays a scrollable list of strings and issues notificiation when a string is selected via the keyboard or the touch screen.
(c) Copyright 2005-2007 DOMOLOGIC GmbH
Field Summary | |
---|---|
static int |
STYLE_ALIGN_CENTER
Style constant for center alignment, i.e. the text is always centered vertically. |
static int |
STYLE_ALIGN_TOP
Style constant for top alignment, i.e. the text is always aligned at the top of the ListBox. |
static int |
STYLE_NONE
Style constant for neither border nor scrollbar look. |
static int |
STYLE_SHOW_BORDER
Style constant for a bordered look. |
static int |
STYLE_SHOW_SCROLLBAR
Style constant for a bordered look with scrollbar. |
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 | |
---|---|
ListBox(int x,
int y,
int width,
int height,
int style)
Constructor for ListBox. |
|
ListBox(java.lang.String[] items,
int x,
int y,
int width,
int height,
int style)
Constructor for ListBox. |
Method Summary | |
---|---|
void |
add(java.lang.String item)
Add a line to the end of the text field. |
int |
getSelectedIndex()
Returns the currently selected index. |
java.lang.String |
getSelectedItem()
Returns the currently selected item. |
void |
insert(int line,
java.lang.String item)
Insert a line of text in the text field at the given zero-relative index. |
KeyEvent |
onKeyEvent(KeyEvent e)
Handle KeyEvents. |
int |
onTouchEvent(TouchEvent e)
Handle TouchEvent. |
void |
paint(jcontrol.graphics.XGraphics g)
Paint this list box. |
void |
remove(int line)
Removes a line from the text field. |
void |
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 |
Field Detail |
---|
public static final int STYLE_ALIGN_CENTER
public static final int STYLE_ALIGN_TOP
public static final int STYLE_NONE
public static final int STYLE_SHOW_BORDER
public static final int STYLE_SHOW_SCROLLBAR
Constructor Detail |
---|
public ListBox(int x, int y, int width, int height, int style)
x
- The x coordinate on the display.y
- The y coordinate on the display.width
- The text field width.height
- The tet field height.style
- STYLE_NONE or STYLE_SHOW_BORDER or STYLE_SHOW_SCROLLBAR or STYLE_ALIGN_TOP or STYLE_ALIGN_CENTERpublic ListBox(java.lang.String[] items, int x, int y, int width, int height, int style)
items
- The text as String array.x
- The x coordinate on the display.y
- The y coordinate on the display.width
- The text field width.height
- The text field height.style
- STYLE_NONE or STYLE_SHOW_BORDER or STYLE_SHOW_SCROLLBAR or STYLE_ALIGN_TOP or STYLE_ALIGN_CENTERMethod Detail |
---|
public void add(java.lang.String item)
item
- The text to add.public int getSelectedIndex()
public java.lang.String getSelectedItem()
public void insert(int line, java.lang.String item)
line
- The line to insert.item
- The text for the row.public KeyEvent onKeyEvent(KeyEvent e)
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 touch event.
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)
paint
in class Component
g
- the application's graphics object.public void remove(int line)
line
- The line to remove.public void setSelection(int index)
index
- the index of the item to select
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |