waba.ui
Class Button
waba.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
Constructor Summary |
Button(String text)
Creates a button displaying the given text. |
Method Summary |
static void |
drawButton(Graphics g,
boolean armed,
int width,
int height)
|
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(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 |
Button
public Button(String text)
- Creates a button displaying the given text.
setText
public void setText(String text)
- Sets the text that is displayed in the button.
getText
public 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