brf.j2me.dynaworks.ui
Class Button

java.lang.Object
  |
  +--brf.j2me.dynaworks.ui.BasicWidget
        |
        +--brf.j2me.dynaworks.ui.Button
All Implemented Interfaces:
UserWidget

public class Button
extends BasicWidget

Custom user control widget for a button.

Version:
1.0
Author:
Bernd R. Fix
See Also:
BasicWidget, UserWidget

Field Summary
private  boolean enabled
          button enabled?
private  java.lang.String label
          button label.
private  boolean pressed
          button pressed?
 
Fields inherited from class brf.j2me.dynaworks.ui.BasicWidget
g, h, w, x, y
 
Constructor Summary
Button(java.lang.String label, int x, int y)
          constructor.
 
Method Summary
 ActionEvent handlePenDown(int xc, int yc)
          Handle a "pen down" event.
 ActionEvent handlePenMove(int xc, int yc)
          Handle a "pen move" event.
 ActionEvent handlePenUp(int xc, int yc)
          Handle a "pen up" event.
 void loseFocus()
          control is losing the focus.
 void paint()
          Paint the user control.
(package private)  void setEnabled(boolean state)
          enable/disable button.
(package private)  void setText(java.lang.String s)
          set the button label.
 
Methods inherited from class brf.j2me.dynaworks.ui.BasicWidget
, contains, handleKeyDown, handleSysKeyDown, hasFocus, setFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

label

private java.lang.String label
button label.


enabled

private boolean enabled
button enabled?


pressed

private boolean pressed
button pressed?

Constructor Detail

Button

public Button(java.lang.String label,
              int x,
              int y)
constructor.

Parameters:
label - String - a label for the button.
x - int - x coordinate of upper-left corner.
y - int - y coordinate of upper-left corner.
Method Detail

loseFocus

public void loseFocus()
control is losing the focus.

Overrides:
loseFocus in class BasicWidget

setEnabled

void setEnabled(boolean state)
enable/disable button.

Parameters:
state - boolean - new mode for button.

setText

void setText(java.lang.String s)
set the button label.

Parameters:
s - String - new button text.

handlePenDown

public ActionEvent handlePenDown(int xc,
                                 int yc)
Handle a "pen down" event. Return an ActionEvent if neccessary.

Overrides:
handlePenDown in class BasicWidget
Parameters:
xc - int - x coordinate of hit point.
yc - int - y coordinate of hit point.
Returns:
ActionEvent - event triggered by PenDown (or null).
See Also:
ActionEvent

handlePenMove

public ActionEvent handlePenMove(int xc,
                                 int yc)
Handle a "pen move" event. Return an ActionEvent if neccessary.

Overrides:
handlePenMove in class BasicWidget
Parameters:
xc - int - x coordinate of pen point.
yc - int - y coordinate of pen point.
Returns:
ActionEvent - event triggered by PenMove (or null).
See Also:
ActionEvent

handlePenUp

public ActionEvent handlePenUp(int xc,
                               int yc)
Handle a "pen up" event. Return an ActionEvent if neccessary.

Overrides:
handlePenUp in class BasicWidget
Parameters:
xc - int - x coordinate of pen point.
yc - int - y coordinate of pen point.
Returns:
ActionEvent - event triggered by PenUp (or null).
See Also:
ActionEvent

paint

public void paint()
Paint the user control.

Overrides:
paint in class BasicWidget