|
|||||||||
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.CheckBox
The CheckBox
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 STATE_CHANGED
is fired.
Field Summary | |
(package private) java.lang.String |
label
|
(package private) boolean |
state
|
Fields inherited from class jcontrol.ui.vole.Component |
focusOwner, font, g, height, listener, parent, visible, width, x, y |
Constructor Summary | |
CheckBox(java.lang.String label,
int x,
int y)
Create a new labeled CheckBox which is initially "off".
|
|
CheckBox(java.lang.String label,
int x,
int y,
int width,
int height)
Create a new labeled CheckBox with specified bounds which
is initially "off". |
Method Summary | |
boolean |
getState()
Get the current state of this CheckBox . |
boolean |
onKeyEvent(KeyEvent e)
Handle key events. |
void |
paint()
Paint the button. |
void |
setActionListener(ActionListener listener)
Add an ActionListener to the check box. |
void |
setLabel(java.lang.String label)
Change the label if this check box. |
void |
setState(boolean state)
Set the state of this CheckBox . |
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, setBounds, setFont, setGraphics, setLocation, setParent, setVisible, transferFocus |
Methods inherited from class java.lang.Object |
clone, equals, finalize, notifyAll, wait |
Field Detail |
java.lang.String label
boolean state
Constructor Detail |
public CheckBox(java.lang.String label, int x, int y)
CheckBox
which is initially "off".
When no width and height are specified, a preferred size depending on the
label dimensions is calculated.
label
- A String
that is written on the CheckBox
.x
- The x-coordinate of this CheckBox
.y
- The y-coordinate of this CheckBox
.public CheckBox(java.lang.String label, int x, int y, int width, int height)
CheckBox
with specified bounds which
is initially "off".
label
- A String
that is written on the CheckBox
.x
- The x-coordinate of this CheckBox
.y
- The y-coordinate of this CheckBox
.width
- The width of this CheckBox
.height
- The height of this CheckBox
.Method Detail |
public boolean getState()
CheckBox
.
public boolean onKeyEvent(KeyEvent e)
onKeyEvent
in class Component
e
- The KeyEvent.
Container
.public void paint()
paint
in class Component
public void setActionListener(ActionListener listener)
ActionListener
to the check box. It will receive
STATE_CHANGED
action events when the state has changed.
listener
- The new ActionListener or null.public void setLabel(java.lang.String label)
label
- The new label or null if the button has no label.public void setState(boolean state)
CheckBox
.
state
- The new state of the check box.public void validate()
validate
in class Component
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |