|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jcontrol.ui.vole.Component | +--jcontrol.ui.vole.ComboBox
The class ComboBox
implements a graphical
combo box for the Vole GUI. The user can open the combo box
giving a KEY_SELECT event and chose an entry using the KEY_SCROLL_UP
and KEY_SCROLL_DOWN events. With another KEY_SELECT event,
the choice is taken and the box is closed.
ActionEvent
of type ITEM_SELECTED
is fired.
(C) DOMOLOGIC Home Automation GmbH 2003
Field Summary | |
(package private) int |
currentItem
|
(package private) java.util.Vector |
items
|
(package private) int |
lastItem
|
(package private) int |
maxheight
|
(package private) int |
minheight
|
(package private) boolean |
opened
|
(package private) int |
shift
|
Fields inherited from class jcontrol.ui.vole.Component |
focusOwner, font, g, height, listener, parent, visible, width, x, y |
Constructor Summary | |
ComboBox()
Creates a new and empty ComboBox. |
|
ComboBox(int x,
int y)
Constructs a new empty ComboBox at the given
x- and y-coordinates. |
|
ComboBox(java.lang.String[] items,
int x,
int y)
Constructs a new ComboBox with a list of items
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 item |
java.lang.String |
getSelectedItem()
Returns the currently selected item |
boolean |
isOpen()
Return whether this ComboBox is in the opened state. |
boolean |
onKeyEvent(KeyEvent e)
Handle key events. |
void |
paint()
Paint this ComboBox . |
boolean |
remove(java.lang.String item)
Removes the first occurrence of item from the
ComboBox . |
java.lang.String |
select(int index)
Selects the specified item. |
void |
setActionListener(ActionListener listener)
Sets an ActionListener for the ComboBox . |
void |
setBounds(int x,
int y,
int width,
int height)
Set the dimensions of this component. |
void |
validate()
Compute this component's preferred size and assign internal values width and height. |
Methods inherited from class jcontrol.ui.vole.Component |
getBounds, getParent, isVisible, onActionEvent, remove, removeFocus, requestFocus, setFont, setGraphics, setLocation, setParent, setVisible, transferFocus |
Methods inherited from class java.lang.Object |
clone, equals, finalize, notifyAll, wait |
Field Detail |
int currentItem
java.util.Vector items
int lastItem
int maxheight
int minheight
boolean opened
int shift
Constructor Detail |
public ComboBox()
public ComboBox(int x, int y)
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
.public ComboBox(java.lang.String[] items, int x, int y)
ComboBox
with a list of items
at the given x- and y-coordinates. The preferred width and height is
internally computed by taking the contained items dimensions.
items
- An array of text-items.x
- The x-coordinate of this ComboBox
.y
- The y-coordinate of this ComboBox
.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 boolean isOpen()
ComboBox
is in the opened state.
ComboBox
is open.public boolean onKeyEvent(KeyEvent e)
ActionEvent
is fired.
onKeyEvent
in class Component
e
- the KeyEvent
Container
.public void paint()
ComboBox
.
paint
in class Component
public boolean remove(java.lang.String item)
item
from the
ComboBox
.
item
- The item to remove from the ComboBox
.
public java.lang.String select(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 void setActionListener(ActionListener listener)
ActionListener
for the ComboBox
. It will
receive ActionEvents
everytime a combo box item is pressed.
listener
- The ActionListener
to assign to this ComboBox
.public void setBounds(int x, int y, int width, int height)
setBounds
in class Component
x
- x coordinate of the upper left cornery
- y coordinate of the upper left cornerwidth
- The width of this componentheight
- The height of this component (this parameter is ignored)public void validate()
validate
in class Component
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |