|
||||||||||
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.LwButton
This is button component, that is a composite component, so it is possible to use any other component as the button label. The component has following features:
addActionListener
and removeActionListener
methods to catch
the event.
getView
static method of LwToolkit.class. It is possible to redefine the view using
LwAdvViewMan as follow:
... LwButton button = new LwButton("Button"); LwAdvViewMan man = new LwAdvViewMan(); man.put("button.off", new LwImgRender("off.gif")); man.put("button.on", new LwImgRender("on.gif")); button.setViewMan(man); ...
... LwContainer buttonLabel = new LwPanel(); buttonLabel.setLwLayout(new LwFlowLayout()); buttonLabel.add(new LwImage("label.gif")); buttonLabel.add(new LwLabel("Button text")); LwButton button = new LwButton(buttonLabel); ...
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 | |
LwButton()
Constructs a button component with no label. |
|
LwButton(LwComponent t)
Constructs a button component with the specified component as a label. |
|
LwButton(java.lang.String lab)
Constructs a button component with the specified label text. |
Method Summary | |
void |
addActionListener(LwActionListener a)
Adds the specified action listener to receive action events from this button. |
void |
endDragged(LwMouseMotionEvent e)
Invoked when the mouse ends dragged. |
void |
focusLost(LwFocusEvent e)
|
boolean |
isPressed()
Gets the state of the button. |
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 |
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()
Fires the action event for list of LwActionListener. |
void |
removeActionListener(LwActionListener a)
Removes the specified action listener so it no longer receives action events from this button. |
protected void |
setPressed(boolean b)
Sets the specified state of the button. |
void |
startDragged(LwMouseMotionEvent e)
Invoked when the mouse starts dragged. |
protected void |
viewManChanged()
Invoked whenever the view manager has been set. |
Methods inherited from class org.zaval.lw.LwActContainer |
canHaveFocus, catchInput, getDefaultLayout, getFocusComponent, getRectColor, paintOnTop, remove, removeAll, setAsFocusComponent, setRectColor |
Methods inherited from class org.zaval.lw.LwPanel |
add, add, calcPreferredSize, count, get, getLayoutOffset, getLwComponentAt, getLwLayout, indexOf, insert, insert, invalidate, recalc, 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, setEnabled, setInsets, setLocation, setLwParent, 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.lw.LwContainer |
add, add, getLwLayout, indexOf, insert, setLwLayout |
Methods inherited from interface org.zaval.lw.LwComponent |
getLwComponentAt, getLwParent, getViewMan, getVisiblePart, setBackground, setEnabled, 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 |
Constructor Detail |
public LwButton()
public LwButton(java.lang.String lab)
lab
- the specified label text.public LwButton(LwComponent t)
t
- the specified component to be used as the button label.Method Detail |
public void addActionListener(LwActionListener a)
a
- the specified action listener.public void removeActionListener(LwActionListener a)
a
- the specified action listener.protected void perform()
public void mouseClicked(LwMouseEvent e)
LwMouseListener
mouseClicked
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 mouseReleased(LwMouseEvent e)
LwMouseListener
mouseReleased
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 keyReleased(LwKeyEvent e)
LwKeyListener
keyReleased
in interface LwKeyListener
org.zaval.lw.event.LwKeyListener
e
- the specified key event.public void focusLost(LwFocusEvent e)
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 startDragged(LwMouseMotionEvent e)
LwMouseMotionListener
startDragged
in interface LwMouseMotionListener
org.zaval.lw.event.LwMouseMotionListener
e
- the specified mouse motion event.public void endDragged(LwMouseMotionEvent e)
LwMouseMotionListener
endDragged
in interface LwMouseMotionListener
org.zaval.lw.event.LwMouseMotionListener
e
- the specified mouse motion event.public void mouseMoved(LwMouseMotionEvent e)
LwMouseMotionListener
mouseMoved
in interface LwMouseMotionListener
org.zaval.lw.event.LwMouseMotionListener
e
- the specified mouse motion event.public void mouseDragged(LwMouseMotionEvent e)
LwMouseMotionListener
mouseDragged
in interface LwMouseMotionListener
org.zaval.lw.event.LwMouseMotionListener
e
- the specified mouse motion event.public void keyTyped(LwKeyEvent e)
LwKeyListener
keyTyped
in interface LwKeyListener
org.zaval.lw.event.LwKeyListener
e
- the specified key event.protected void viewManChanged()
viewManChanged
in class LwCanvas
protected void setPressed(boolean b)
b
- the specified state. The true
value is used to
set the "pressed" state, the false
value to set the "unpressed" state.public boolean isPressed()
true
if the button is "pressed", false
if the button
is "unpressed".
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |