|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.zaval.util.ValidationObject | +--org.zaval.lw.LwCanvas | +--org.zaval.lw.LwPanel | +--org.zaval.lw.LwActContainer | +--org.zaval.lw.LwCheckbox
The class represents a switching GUI componenent that can have one of two states: "on" or "off". The component is a container that consists of a label component and a box component. It is possible to use any light weight component as the label or the box. The box component is used to indicate a state of the component. The component supports two box view types:
setBoxType
method
to redefine the box view type.
It is possible to customize the box component by setBox
method. The default box
component is a LwCanvas component. The checkbox component sets eight views for the component:
... LwCheckbox checkbox = new LwCheckbox("Checkbox"); LwComponent box = checkbox.getBox(); LwAdvViewMan man = new LwAdvViewMan(); man.put("check.on", LwImgRender("chOn.gif")); man.put("check.off", LwImgRender("chOff.gif")); box.setViewMan(man); ...
The component uses LwSwitchManager class to control state of the component. Use
setSwitchManager
method to define the switch manager and
getSwitchManager
to get the current switch manager. Use the switch
manager to listen action events that are performed whenever the state of the
component has been changed.
Field Summary | |
static int |
CHECK
The checkbox box type. |
static int |
RADIO
The radio box type. |
Fields inherited from class org.zaval.lw.LwPanel |
children |
Fields inherited from class org.zaval.lw.LwCanvas |
bits, height, insets, parent, psHeight, psWidth, skins, width, x, y |
Fields inherited from class org.zaval.util.ValidationObject |
isValidFlag |
Constructor Summary | |
LwCheckbox()
Constructs a checkbox component with no label. |
|
LwCheckbox(LwComponent c,
int type)
Constructs a checkbox component with the specified component as a label and the given box view type. |
|
LwCheckbox(java.lang.String lab)
Constructs a checkbox component with the specified label text. |
|
LwCheckbox(java.lang.String lab,
int type)
Constructs a checkbox component with the specified label text and the given box view type. |
Method Summary | |
LwComponent |
getBox()
Gets the component that is used as a the box component with the component. |
int |
getBoxType()
Gets the box view type. |
boolean |
getState()
Gets the state of the checkbox. |
LwSwitchManager |
getSwitchManager()
Gets the switch manager that is used with the checkbox. |
void |
keyPressed(LwKeyEvent e)
Invoked when a key has been pressed. |
void |
keyReleased(LwKeyEvent e)
Invoked when a key has been released. |
void |
keyTyped(LwKeyEvent e)
Invoked when a key has been typed. |
void |
mouseClicked(LwMouseEvent e)
Invoked when the mouse button has been clicked on a light weight component. |
void |
mouseEntered(LwMouseEvent e)
Invoked when the mouse enters a light weight component. |
void |
mouseExited(LwMouseEvent e)
Invoked when the mouse exits a light weight component. |
void |
mousePressed(LwMouseEvent e)
Invoked when the mouse button has been pressed on a light weight component. |
void |
mouseReleased(LwMouseEvent e)
Invoked when the mouse button has been released on a light weight component. |
protected void |
recalc()
Invoked with validate method only if the component is not valid. |
void |
remove(int i)
Removes the component, specified by the index, from this container. |
void |
removeAll()
Removes all child components from this container. |
void |
setBox(int i)
Sets a child component as the box component by the specified child index. |
void |
setBox(LwComponent b)
Sets the specified component as the box component. |
void |
setBoxType(int t)
Sets the specified box view type. |
void |
setEnabled(boolean b)
Enables or disables this component. |
void |
setState(boolean b)
Sets the specified state of the checkbox. |
void |
setSwitchManager(LwSwitchManager m)
Sets the specified switch manager to control state of the component. |
void |
switchedOff()
Invoked when the state of a switching component has been changed to "off" with the switch manager. |
void |
switchedOn()
Invoked when the state of a switching component has been changed to "on" with the switch manager. |
void |
sync()
Invoked whenever it is necessary to set appropriate box view for the current state. |
Methods inherited from class org.zaval.lw.LwActContainer |
canHaveFocus, catchInput, getDefaultLayout, getFocusComponent, getRectColor, paintOnTop, setAsFocusComponent, setRectColor |
Methods inherited from class org.zaval.lw.LwPanel |
add, add, calcPreferredSize, count, get, getLayoutOffset, getLwComponentAt, getLwLayout, indexOf, insert, insert, invalidate, remove, setBackground, setLwLayout, setOpaque, toFront, updateCashedPs |
Methods inherited from class org.zaval.lw.LwCanvas |
getBackground, getBounds, getHeight, getInsets, getLocation, getLwParent, getOrigin, getPreferredSize, getSize, getViewMan, getVisiblePart, getWidth, getX, getY, hasFocus, isEnabled, isOpaque, isVisible, paint, repaint, repaint, requestFocus, setInsets, setLocation, setLwParent, setPSSize, setSize, setViewMan, setVisible, toString, update, validate, viewManChanged, vrp |
Methods inherited from class org.zaval.util.ValidationObject |
isValid |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.zaval.lw.LwContainer |
add, add, getLwLayout, indexOf, insert, setLwLayout |
Methods inherited from interface org.zaval.lw.LwComponent |
getLwComponentAt, getLwParent, getViewMan, getVisiblePart, setBackground, setLwParent, setViewMan, setVisible |
Methods inherited from interface org.zaval.lw.Drawable |
getBackground, getOrigin, isEnabled, isOpaque, paint, repaint, repaint, setOpaque, update |
Methods inherited from interface org.zaval.util.Validationable |
invalidate, isValid, validate |
Methods inherited from interface org.zaval.lw.Layoutable |
getBounds, getHeight, getInsets, getLocation, getPreferredSize, getSize, getWidth, getX, getY, isVisible, setLocation, setSize |
Methods inherited from interface org.zaval.lw.LayoutContainer |
count, get, getLayoutOffset |
Field Detail |
public static final int RADIO
public static final int CHECK
Constructor Detail |
public LwCheckbox()
public LwCheckbox(java.lang.String lab)
lab
- the specified label text.public LwCheckbox(java.lang.String lab, int type)
lab
- the specified label text.type
- the box view type.public LwCheckbox(LwComponent c, int type)
c
- the specified component to be used as the checkbox label.type
- the box view type.Method Detail |
public void setBoxType(int t)
t
- the specified box view type.public int getBoxType()
public void setBox(int i)
i
- the specified child index.public void setBox(LwComponent b)
b
- the specified component.public LwComponent getBox()
public void setSwitchManager(LwSwitchManager m)
m
- the specified switch manager. It is impossible to use null
value as the switch manager, in this case IllegalArgumentException will be thrown.public LwSwitchManager getSwitchManager()
public void setState(boolean b)
b
- the specified state. Use true
to set "on" state and
false
to set "off" state.public boolean getState()
public void switchedOn()
switchedOn
in interface Switchable
public void switchedOff()
switchedOff
in interface Switchable
public void sync()
public void setEnabled(boolean b)
LwComponent
setEnabled
in class LwCanvas
org.zaval.lw.LwComponent
b
- if the value is true
- enables the component;
otherwise disables this component.public void mouseClicked(LwMouseEvent e)
LwMouseListener
mouseClicked
in interface LwMouseListener
org.zaval.lw.event.LwMouseListener
e
- the specified mouse event.public void mouseReleased(LwMouseEvent e)
LwMouseListener
mouseReleased
in interface LwMouseListener
org.zaval.lw.event.LwMouseListener
e
- the specified mouse event.public void mousePressed(LwMouseEvent e)
LwMouseListener
mousePressed
in interface LwMouseListener
org.zaval.lw.event.LwMouseListener
e
- the specified mouse event.public void keyPressed(LwKeyEvent e)
LwKeyListener
keyPressed
in interface LwKeyListener
org.zaval.lw.event.LwKeyListener
e
- the specified key event.public void remove(int i)
LwContainer
componentRemoved
method of the manager.remove
in class LwActContainer
org.zaval.lw.LwContainer
index
- the index of the component to be removed.public void removeAll()
LwContainer
componentRemoved
method of the manager for every child component
that has been removed.removeAll
in class LwActContainer
public void mouseEntered(LwMouseEvent e)
LwMouseListener
mouseEntered
in interface LwMouseListener
org.zaval.lw.event.LwMouseListener
e
- the specified mouse event.public void mouseExited(LwMouseEvent e)
LwMouseListener
mouseExited
in interface LwMouseListener
org.zaval.lw.event.LwMouseListener
e
- the specified mouse event.public void keyReleased(LwKeyEvent e)
LwKeyListener
keyReleased
in interface LwKeyListener
org.zaval.lw.event.LwKeyListener
e
- the specified key event.public void keyTyped(LwKeyEvent e)
LwKeyListener
keyTyped
in interface LwKeyListener
org.zaval.lw.event.LwKeyListener
e
- the specified key event.protected void recalc()
LwPanel
validate
method only if the component is not valid.
The method should not be overrided for this container like it can be done for LwCanvas,
because the method starts validating and layouting of the child components.recalc
in class LwPanel
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |