waba.ui
Class Button

java.lang.Object
  |
  +--waba.ui.Control
        |
        +--waba.ui.Button

public class Button
extends Control

Button is a push button control.

Here is an example showing a push button being used:

 public class MyProgram extends MainWindow
 {
 Button pushB;

 public void onStart()
  {
  pushB = new Button("Push me");
  pushB.setRect(10, 10, 80, 30);
  add(pushB);
  }

 public void onEvent(Event event)
  {
  if (event.type == ControlEvent.PRESSED &&
      event.target == pushB)
   {
   ... handle pushB being pressed
 


Fields inherited from class waba.ui.Control
height, next, parent, prev, width, x, y
 
Constructor Summary
Button(java.lang.String text)
          Creates a button displaying the given text.
 
Method Summary
static void drawButton(Graphics g, boolean armed, int width, int height)
           
 java.lang.String getText()
          Gets the text displayed in the button.
 void onEvent(Event event)
          Called by the system to pass events to the button.
 void onPaint(Graphics g)
          Called by the system to draw the button.
 void setText(java.lang.String text)
          Sets the text that is displayed in the button.
 
Methods inherited from class waba.ui.Control
addTimer, contains, createGraphics, getFontMetrics, getNext, getParent, getRect, postEvent, removeTimer, repaint, setRect
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Button

public Button(java.lang.String text)
Creates a button displaying the given text.
Method Detail

setText

public void setText(java.lang.String text)
Sets the text that is displayed in the button.

getText

public java.lang.String getText()
Gets the text displayed in the button.

onEvent

public void onEvent(Event event)
Called by the system to pass events to the button.
Overrides:
onEvent in class Control
Tags copied from class: Control
Parameters:
event - the event to process
See Also:
Event, KeyEvent, PenEvent

drawButton

public static void drawButton(Graphics g,
                              boolean armed,
                              int width,
                              int height)

onPaint

public void onPaint(Graphics g)
Called by the system to draw the button.
Overrides:
onPaint in class Control
Tags copied from class: Control
Parameters:
g - the graphics object for drawing
See Also:
Graphics