Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jcontrol.ui.wombat
Class ListBox

    java.lang.Object
      jcontrol.ui.wombat.Component
          jcontrol.ui.wombat.AbstractFocusComponent
              jcontrol.ui.wombat.AbstractScrolledComponent
                  jcontrol.ui.wombat.ListBox

All Implemented Interfaces:
  EventListener, ActionProducer, KeyListener, TouchListener, IFocusable

    public class ListBox

extends AbstractScrolledComponent

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 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 class jcontrol.ui.wombat.Component
`backgroundColor, COLOR_COMPONENT_BACKGROUND, COLOR_COMPONENT_BACKGROUND_HIGHLIGHTED, COLOR_COMPONENT_DARK_SHADOW, COLOR_COMPONENT_FOREGROUND, COLOR_COMPONENT_FOREGROUND_INACTIVE, COLOR_COMPONENT_HIGHLIGHT_SHADOW, COLOR_COMPONENT_LIGHT_SHADOW, COLOR_COMPONENT_LIST_BACKGROUND, COLOR_COMPONENT_NORMAL_SHADOW, COLOR_COMPONENT_SELECTION_TEXT, COLOR_COMPONENT_SELECTION_TEXT_BACKGROUND, COLOR_COMPONENT_SELECTION_TEXT_BACKGROUND_INACTIVE, COLOR_COMPONENT_SELECTION_TEXT_INACTIVE, eventQueue, font, foregroundColor, frame, height, parent, RESERVED1, RESERVED2, RESERVED3, RESERVED4, RESERVED5, RESERVED6, state, STATE_ABORT_UPDATE, STATE_ANIMATED, STATE_BG_COLOR_SET, STATE_COVERED, STATE_DIRTY_MASK, STATE_DIRTY_PAINTALL, STATE_DIRTY_REPAINT, STATE_DIRTY_UPDATE, STATE_DISABLED, STATE_DISPOSED, STATE_FG_COLOR_SET, STATE_FOCUS, STATE_HEIGHT_FIXED, STATE_NO_REDRAW, STATE_REVALIDATE, STATE_SELECTED, STATE_SIZE_FIXED, STATE_UPDATED, STATE_VISIBLE, STATE_WIDTH_FIXED, transparentColor, width, x, y`

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(String[] items, int x, int y, int width, int height, int style)` Constructor for ListBox.

Method Summary
`void` | `add(String item)` Add a line to the end of the text field.
`int` | `getSelectedIndex()` Returns the currently selected index.
`String` | `getSelectedItem()` Returns the currently selected item.
`void` | `insert(int line, 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(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.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`

Field Detail

### STYLE_NONE

    public static final int STYLE_NONE

  Style constant for neither border nor scrollbar look.

  See Also:
    Constant Field Values

### STYLE_SHOW_BORDER

    public static final int STYLE_SHOW_BORDER

  Style constant for a bordered look.

  See Also:
    Constant Field Values

### STYLE_SHOW_SCROLLBAR

    public static final int STYLE_SHOW_SCROLLBAR

  Style constant for a bordered look with scrollbar.

  See Also:
    Constant Field Values

### STYLE_ALIGN_TOP

    public static final int STYLE_ALIGN_TOP

  Style constant for top alignment, i.e. the text is always aligned at the top of the ListBox. Note that this may result in a blank area at the bottom of the ListBox even if the entire number of lines exceeds the number of visible lines.

  See Also:
    Constant Field Values

### STYLE_ALIGN_CENTER

    public static final int STYLE_ALIGN_CENTER

  Style constant for center alignment, i.e. the text is always centered vertically. This is the default alignment.

  See Also:
    Constant Field Values

Constructor Detail

### ListBox

    public ListBox(String[] items,
                   int x,
                   int y,
                   int width,
                   int height,
                   int style)

  Constructor for ListBox.

  Parameters:
    `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_CENTER

### ListBox

    public ListBox(int x,
                   int y,
                   int width,
                   int height,
                   int style)

  Constructor for ListBox.

  Parameters:
    `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_CENTER

Method Detail

### insert

    public void insert(int line,
                       String item)

  Insert a line of text in the text field at the given zero-relative index.

  Parameters:
    `line` - The line to insert.
    `item` - The text for the row.

### add

    public void add(String item)

  Add a line to the end of the text field.

  Parameters:
    `item` - The text to add.

### remove

    public void remove(int line)

  Removes a line from the text field.

  Parameters:
    `line` - The line to remove.

### setSelection

    public void setSelection(int index)

  Selects the item at the given zero-relative index in the receiver's list. If the item at the index was already selected, it remains selected. Indices that are out of range are ignored.

  Parameters:
    `index` - the index of the item to select

### getSelectedIndex

    public int getSelectedIndex()

  Returns the currently selected index.

  Returns:
    the selected index

### getSelectedItem

    public String getSelectedItem()

  Returns the currently selected item.

  Returns:
    the selected item

### paint

    public void paint(XGraphics g)

  Paint this list box. Don't call this method directly.

  Overrides:
    `paint` in class `Component`
  Parameters:
    `g` - the application's graphics object.

### onKeyEvent

    public KeyEvent onKeyEvent(KeyEvent e)

  Handle KeyEvents.

  Specified by:
    `onKeyEvent` in interface `KeyListener`
  Specified by:
    `onKeyEvent` in class `AbstractFocusComponent`
  Parameters:
    `e` - the event that contains information about the key.
  Returns:
    `null` if the KeyEvent has been consumed by the KeyListener,
    or the the specified KeyEvent if it should be passed on to the next KeyListener.

### onTouchEvent

    public int onTouchEvent(TouchEvent e)

  Handle TouchEvent.

  Specified by:
    `onTouchEvent` in interface `TouchListener`
  Specified by:
    `onTouchEvent` in class `AbstractFocusComponent`
  Parameters:
    `e` - The touch event.
  Returns:
    `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.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD