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

## waba.ui
Class ComboBox

    java.lang.Object
      |
      +--waba.ui.Control
            |
            +--waba.ui.Container
                  |
                  +--waba.ui.ComboBox

public class ComboBox
extends Container

ComboBox is a simple implementation of a ComboBox.

Note: the color used in the setBackground method will be used in the button only. The background color of the control will be a lighter version of the given color.

Field Summary
`boolean` | `fullHeight` if set to true, the popup window will have the height of the screen

Fields inherited from class waba.ui.Container
`BORDER_LOWERED, BORDER_NONE, BORDER_RAISED, BORDER_SIMPLE, children, lastH, lastW, lastX, lastY, parentWindow, tail`

Fields inherited from class waba.ui.Control
`AFTER, appId, asContainer, asWindow, backColor, backDis, BEFORE, BOTTOM, CENTER, enabled, FILL, FIT, fm, fmH, focusLess, font, foreColor, foreDis, height, LEFT, parent, PREFERRED, RANGE, RIGHT, SAME, TOP, visible, width, x, x2, y, y2`

Constructor Summary
`ComboBox()` Creates an empty ComboBox
`ComboBox(ListBox userListBox)` Creates a ComboBox with a PopList containing the given ListBox.
`ComboBox(Object[] items)` Creates a ComboBox with the given items
`ComboBox(PopList userPopList)` Constructs a ComboBox with the given PopList.

Method Summary
`void` | `add(Control control)` do nothing
`void` | `add(Object item)` Adds an Object to the Listbox
`void` | `add(Object[] items)` Adds an array of Objects to the Listbox
`Object` | `getItemAt(int i)` Get the Object at the given Index
`Object[]` | `getItems()` Returns all items in this ComboBox
`int` | `getPreferredHeight()` Returns the preffered height of this control.
`int` | `getPreferredWidth()` Returns the preffered width of this control.
`int` | `getSelectedIndex()` Returns the position of the selected item of the PopList
`Object` | `getSelectedItem()` Returns the selected item of the PopList
`int` | `indexOf(Object name)` Returns the index of the item specified by the name
`void` | `insert(Object item, int index)` Adds an Object to the Listbox at the given index
`protected void` | `onBoundsChanged()` Called after an setRect.
`protected void` | `onColorsChanged(boolean colorsChanged)` Called after a setEnabled, setForeColor and setBackColor and when a control has been added to a Container.
`void` | `onEvent(Event event)` Called to process key, pen, control and other posted events.
`protected void` | `onFontChanged()` passes the font to the pop list
`void` | `onPaint(Graphics g)` paint the combo's border and the current selected item
`void` | `qsort()` Sorts the items of this combobox
`void` | `remove(Control control)` do nothing
`void` | `remove(int itemIndex)` Removes an Object from the Listbox
`void` | `remove(Object item)` Removes an Object from the Listbox
`void` | `removeAll()` Empties the ListBox
`void` | `select(int i)` Select an item
`void` | `setCursorColor(Color color)` Sets the cursor color for this ComboBox.
`void` | `setItemAt(int i, Object s)` Sets the Object at the given Index, starting from 0
`int` | `size()` Returns the number of items

Methods inherited from class waba.ui.Container
`add, add, broadcastEvent, findChild, getChildren, getClientRect, onStart, paintChildren, setBorderStyle, setEnabled`

Methods inherited from class waba.ui.Control
`addTimer, contains, createGraphics, getAbsoluteRect, getBackColor, getFont, getFontMetrics, getForeColor, getNext, getParent, getParentWindow, getPos, getRect, getSize, isDisplayed, isEnabled, isVisible, onWindowPaintFinished, postEvent, removeTimer, repaint, repaintNow, requestFocus, setBackColor, setBackForeColors, setFocusLess, setFont, setForeColor, setRect, setRect, setRect, setVisible`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, toString, wait, wait`

Field Detail

### fullHeight

    public boolean fullHeight

  if set to true, the popup window will have the height of the screen

Constructor Detail

### ComboBox

    public ComboBox()

  Creates an empty ComboBox

### ComboBox

    public ComboBox(Object[] items)

  Creates a ComboBox with the given items

### ComboBox

    public ComboBox(ListBox userListBox)

  Creates a ComboBox with a PopList containing the given ListBox. You can extend the ListBox to draw the items by yourself and use this constructor so the PopList will use your class and not the default ListBox one. Note that this constructor forces the ListBox.simpleBorder to true. Note: the listbox items must be already set.

### ComboBox

    public ComboBox(PopList userPopList)

  Constructs a ComboBox with the given PopList.

Method Detail

### add

    public void add(Control control)

  do nothing
  Overrides:
    add in class Container

### remove

    public void remove(Control control)

  do nothing
  Overrides:
    remove in class Container

### add

    public void add(Object[] items)

  Adds an array of Objects to the Listbox

### add

    public void add(Object item)

  Adds an Object to the Listbox

### insert

    public void insert(Object item,
                       int index)

  Adds an Object to the Listbox at the given index

### removeAll

    public void removeAll()

  Empties the ListBox

### remove

    public void remove(Object item)

  Removes an Object from the Listbox

### remove

    public void remove(int itemIndex)

  Removes an Object from the Listbox

### setItemAt

    public void setItemAt(int i,
                          Object s)

  Sets the Object at the given Index, starting from 0

### getItemAt

    public Object getItemAt(int i)

  Get the Object at the given Index

### getSelectedItem

    public Object getSelectedItem()

  Returns the selected item of the PopList

### getSelectedIndex

    public int getSelectedIndex()

  Returns the position of the selected item of the PopList

### getItems

    public Object[] getItems()

  Returns all items in this ComboBox

### indexOf

    public int indexOf(Object name)

  Returns the index of the item specified by the name

### setCursorColor

    public void setCursorColor(Color color)

  Sets the cursor color for this ComboBox. The default is equal to the background slightly darker. Make sure you tested it in 2,4 and 8bpp devices.

### select

    public void select(int i)

  Select an item

### size

    public int size()

  Returns the number of items

### getPreferredWidth

    public int getPreferredWidth()

  Description copied from class: Control
  Returns the preffered width of this control.
  Overrides:
    getPreferredWidth in class Control

### getPreferredHeight

    public int getPreferredHeight()

  Description copied from class: Control
  Returns the preffered height of this control.
  Overrides:
    getPreferredHeight in class Control

### onFontChanged

    protected void onFontChanged()

  passes the font to the pop list
  Overrides:
    onFontChanged in class Control

### onBoundsChanged

    protected void onBoundsChanged()

  Description copied from class: Control
  Called after an setRect.
  Overrides:
    onBoundsChanged in class Control

### onEvent

    public void onEvent(Event event)

  Description copied from class: Control
  Called to process key, pen, control and other posted events.
  Overrides:
    onEvent in class Control
  Tags copied from class: Control
  Parameters:
    `event` - the event to process
  See Also:
    `Event`, `KeyEvent`, `PenEvent`

### onColorsChanged

    protected void onColorsChanged(boolean colorsChanged)

  Description copied from class: Control
  Called after a setEnabled, setForeColor and setBackColor and when a control has been added to a Container. If colorsChanged is true, it was called from setForeColor/setBackColor/Container.add; otherwise, it was called from setEnabled
  Overrides:
    onColorsChanged in class Container

### onPaint

    public void onPaint(Graphics g)

  paint the combo's border and the current selected item
  Overrides:
    onPaint in class Container
  Tags copied from class: Control
  Parameters:
    `g` - the graphics object for drawing
  See Also:
    `Graphics`

### qsort

    public void qsort()

  Sorts the items of this combobox

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