|
|||||||||
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.ToggleSwitch
public class ToggleSwitch
The ToggleSwitch
is a graphical component that can
be in either an "on" (true) or "off" (false) state.
When the user changes the state, an ActionEvent
of type ActionEvent.STATE_CHANGED
is fired.
(c) Copyright 2005-2007 DOMOLOGIC GmbH
Field Summary |
---|
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 | |
---|---|
ToggleSwitch(int x,
int y)
Create a new ToggleSwitch . |
Method Summary | |
---|---|
boolean |
isSelected()
Get the current state of this ToggleSwitch . |
KeyEvent |
onKeyEvent(KeyEvent e)
This method is called when a keyboard action has been performed. |
int |
onTouchEvent(TouchEvent e)
Every time a touch event is fired, this method will be called. |
void |
paint(XGraphics g)
Paint the ToggleSwitch. |
void |
setBounds(int x,
int y,
int width,
int height)
Set the dimensions of this component. |
void |
setSelected(boolean onoff)
Set the state of this ToggleSwitch . |
void |
setText(String onLabel,
String offLabel)
Sets the inscription label for this ToggleSwitch . |
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, 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 ToggleSwitch(int x, int y)
ToggleSwitch
.
x
- The x-coordinate of this ToggleSwitch
.y
- The y-coordinate of this ToggleSwitch
.Method Detail |
---|
public void setText(String onLabel, String offLabel)
ToggleSwitch
. The
onLabel is painted above, the offLabel is painted below the switch.
onLabel
- the on labeloffLabel
- the off labelpublic void setBounds(int x, int y, int width, int height)
Component
setBounds
in class Component
x
- The x-coordinate of the upper left cornery
- The y-coordinate of the upper left cornerwidth
- The width of this componentheight
- The height of this componentComponent.setBounds(int, int, int, int)
public void setSelected(boolean onoff)
ToggleSwitch
.
onoff
- The new state of the ToggleSwitch
.public boolean isSelected()
ToggleSwitch
.
ToggleSwitch
.public void paint(XGraphics g)
paint
in class Component
g
- the application's graphics object.public int onTouchEvent(TouchEvent e)
TouchListener
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 KeyEvent onKeyEvent(KeyEvent e)
AbstractFocusComponent
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,
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |