Ascent Phase Corp.

org.ascentphase.suit
Class Button

java.lang.Object
  |
  +--org.ascentphase.suit.Widget
        |
        +--org.ascentphase.suit.Button
Direct Known Subclasses:
Trigger

public class Button
extends Widget

A button component which the user presses to start an application process.

Version:
Author:
huyd

Field Summary
protected  int btnHeight
           
protected  int btnWidth
           
protected  java.lang.String label
           
protected  boolean penDown
           
 
Fields inherited from class org.ascentphase.suit.Widget
cmdToThrow
 
Constructor Summary
Button(java.lang.String text)
          Initializes a button with the given text.
 
Method Summary
 boolean contains(int x, int y)
          Returns whether the given coordinate lies within this widget's area of interest.
 void paint(Graphics g)
          Draws the widget.
 Command pointerPressed(int x, int y)
          Method called by the widget's containing Panel when a pointer is pressed over the widget area.
 Command pointerReleased(int x, int y)
          Method called by the widget's containing Panel when a pointer is released over the widget area.
 
Methods inherited from class org.ascentphase.suit.Widget
getCommand, keyPressed, keyReleased, pointerDragged, setCommand
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

label

protected java.lang.String label

btnWidth

protected int btnWidth

btnHeight

protected int btnHeight

penDown

protected boolean penDown
Constructor Detail

Button

public Button(java.lang.String text)
Initializes a button with the given text.

Parameters:
text - the text to display on the Button.
Method Detail

paint

public void paint(Graphics g)
Draws the widget.

Specified by:
paint in class Widget
Parameters:
g - the Graphics object to draw with.

contains

public boolean contains(int x,
                        int y)
Description copied from class: Widget
Returns whether the given coordinate lies within this widget's area of interest. The coordinate is relative to this widget's coordinate system. This method should return true if the coordinate given is of interest to the widget and the widget wishes to receive the keyXXX events and the pointerXXX events.

Overrides:
contains in class Widget
Parameters:
x - the x coordinate.
y - the y coordinate.

pointerPressed

public Command pointerPressed(int x,
                              int y)
Description copied from class: Widget
Method called by the widget's containing Panel when a pointer is pressed over the widget area. By default, if this method is not over-ridden, it returns null to indicate no Command event.

Overrides:
pointerPressed in class Widget
Parameters:
x - the x-coordinate relative to the widget's origin.
y - the y-coordinate relative to the widget's origin.
Returns:
a Command event to notify any listeners, or null if none.

pointerReleased

public Command pointerReleased(int x,
                               int y)
Description copied from class: Widget
Method called by the widget's containing Panel when a pointer is released over the widget area. By default, if this method is not over-ridden, it returns null to indicate no Command event.

Overrides:
pointerReleased in class Widget
Parameters:
x - the x-coordinate relative to the widget's origin.
y - the y-coordinate relative to the widget's origin.
Returns:
a Command event to notify any listeners, or null if none.

Ascent Phase Corp.

Copyright © 2002 Ascent Phase Corp. All Rights Reserved.