|
||||||||||
| 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.LwStButton
This is state button component. First of all, the component can have one of the following
states that can be got by getState() method:
stateChanged method
will be called.
Second, the component tries to use a view for appropriate state as follow:
The component generates LwActionEvent whenever the button has been pressed or released.
Use addActionListener and removeActionListener methods
to handle the events. Use fireByPress method to define what event should
perform the action event: mouse released or mouse pressed event. Moreover, the component
allows to set action event repeatable time. In this case the action event will be performed
again if for example a mouse button is kept down certain time.
The sample below illustrates the component usage for creating tool bar button:
...
LwStButton b = new LwStButton();
LwAdvViewMan m = new LwAdvViewMan();
m.put ("st.over", new LwImgRender("over.gif"));
m.put ("st.out", new LwImgRender("out.gif"));
m.put ("st.pressed", new LwImgRender("out.gif"));
b.setViewMan (m);
...
| Field Summary | |
static int |
ST_DISABLED
The DISABLED state. |
static int |
ST_ONSURFACE
The ONSURFACE state. |
static int |
ST_OUTSURFACE
The OUTSURFACE state. |
static int |
ST_PRESSED
The PRESSED state. |
| 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 | |
LwStButton()
Constructs the class instance. |
|
| Method Summary | |
void |
addActionListener(LwActionListener a)
Adds the specified action listener to receive action events from this component. |
void |
endDragged(LwMouseMotionEvent e)
Invoked when the mouse ends dragged. |
void |
fireByPress(boolean b,
int time)
Sets the trigger event to generate action event by the component and the given repeatable time. |
int |
getState()
Gets the current button state. |
boolean |
isFireByPress()
Tests if the action event will be perfomed by mouse pressed event. |
void |
mouseClicked(LwMouseEvent e)
Invoked when the mouse button has been clicked on a light weight component. |
void |
mouseDragged(LwMouseMotionEvent e)
Invoked when a mouse button is pressed on a component and then dragged. |
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 |
mouseMoved(LwMouseMotionEvent e)
Invoked when the mouse pointer has been moved on a light weight component (with no buttons no down). |
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 |
perform(LwActionEvent e)
Fires the specified action event to the registered listeners. |
void |
removeActionListener(LwActionListener a)
Removes the specified action listener so it no longer receives action events from this component. |
void |
run()
|
void |
setEnabled(boolean b)
Enables or disables this component. |
protected void |
setState(int s)
Sets the specified button state. |
void |
startDragged(LwMouseMotionEvent e)
Invoked when the mouse starts dragged. |
protected void |
stateChanged(int state,
int prevState)
Invoked when the state of the component has been changed. |
void |
sync()
Invoked whenever it is necessary to set appropriate state view for the current state. |
protected void |
viewManChanged()
Invoked whenever the view manager has been changed. |
| Methods inherited from class org.zaval.lw.LwCanvas |
calcPreferredSize, canHaveFocus, getBackground, getBounds, getHeight, getInsets, getLocation, getLwComponentAt, getLwParent, getOrigin, getPreferredSize, getSize, getViewMan, getVisiblePart, getWidth, getX, getY, hasFocus, invalidate, isEnabled, isOpaque, isVisible, paint, recalc, repaint, repaint, requestFocus, setBackground, setInsets, setLocation, setLwParent, setOpaque, setPSSize, setSize, setViewMan, setVisible, toString, update, validate, 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.util.Validationable |
isValid |
| Field Detail |
public static final int ST_ONSURFACE
public static final int ST_PRESSED
public static final int ST_OUTSURFACE
public static final int ST_DISABLED
| Constructor Detail |
public LwStButton()
| Method Detail |
public boolean isFireByPress()
true if the action event is perfomrd by mouse pressed event;
false if the action event is perfomrd by mouse released event;
public void fireByPress(boolean b,
int time)
b - true to set mouse pressed event as the trigger,
false to set mouse released event as the trigger.time - the repeatable time. The time defines an interval after
the action event will be performed again if the trigger event is not switched off.
Use -1 as the property value to disable the event repeating.public void mouseClicked(LwMouseEvent e)
LwMouseListenermouseClicked in interface LwMouseListenerorg.zaval.lw.event.LwMouseListenere - the specified mouse event.public void mouseEntered(LwMouseEvent e)
LwMouseListenermouseEntered in interface LwMouseListenerorg.zaval.lw.event.LwMouseListenere - the specified mouse event.public void mouseExited(LwMouseEvent e)
LwMouseListenermouseExited in interface LwMouseListenerorg.zaval.lw.event.LwMouseListenere - the specified mouse event.public void mousePressed(LwMouseEvent e)
LwMouseListenermousePressed in interface LwMouseListenerorg.zaval.lw.event.LwMouseListenere - the specified mouse event.public void mouseReleased(LwMouseEvent e)
LwMouseListenermouseReleased in interface LwMouseListenerorg.zaval.lw.event.LwMouseListenere - the specified mouse event.public void startDragged(LwMouseMotionEvent e)
LwMouseMotionListenerstartDragged in interface LwMouseMotionListenerorg.zaval.lw.event.LwMouseMotionListenere - the specified mouse motion event.public void endDragged(LwMouseMotionEvent e)
LwMouseMotionListenerendDragged in interface LwMouseMotionListenerorg.zaval.lw.event.LwMouseMotionListenere - the specified mouse motion event.public void mouseMoved(LwMouseMotionEvent e)
LwMouseMotionListenermouseMoved in interface LwMouseMotionListenerorg.zaval.lw.event.LwMouseMotionListenere - the specified mouse motion event.public void mouseDragged(LwMouseMotionEvent e)
LwMouseMotionListenermouseDragged in interface LwMouseMotionListenerorg.zaval.lw.event.LwMouseMotionListenere - the specified mouse motion event.public int getState()
public void addActionListener(LwActionListener a)
a - the specified action listener.public void removeActionListener(LwActionListener a)
a - the specified action listener.public void setEnabled(boolean b)
LwCanvassetEnabled in class LwCanvasorg.zaval.lw.LwCanvasb - if true, this component is
enabled; otherwise this component is disabled.public void sync()
public void run()
run in interface java.lang.Runnableprotected void viewManChanged()
LwCanvasviewManChanged in class LwCanvasprotected void setState(int s)
s - the specified button state.
protected void stateChanged(int state,
int prevState)
state - the new state of the component.prevState - the previous state of the component.protected void perform(LwActionEvent e)
e - the specified action event.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||