waba.ui
Class Check

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

public class Check
extends Control

Check is a check control.

Here is an example showing a check being used:

 public class MyProgram extends MainWindow
 {
 Check check;

 public void onStart()
  {
  check = new Check("Check me");
  check.setRect(10, 10, 80, 30);
  add(check);
  }
 
 public void onEvent(Event event)
  {
  if (event.type == ControlEvent.PRESSED &&
      event.target == check)
   {
   ... handle check being pressed
 


Fields inherited from class waba.ui.Control
BOTTOM, CENTER, controlCount, enabled, FILL, fm, font, height, LEFT, name, next, parent, PREFERRED, prev, RIGHT, TOP, width, x, y
 
Constructor Summary
Check(java.lang.String text)
          Creates a check control displaying the given text.
 
Method Summary
static void drawCheck(Graphics g, boolean checked, int x, int y)
          Draws the check box graphic at the given position.
 boolean getChecked()
          Returns the checked state of the control.
 int getPreferredHeight()
          returns the preffered height of this control. added by guich
 int getPreferredWidth()
          returns the preffered width of this control. added by guich
 java.lang.String getText()
          Gets the text displayed in the check.
 void onEvent(Event event)
          Called by the system to pass events to the check control.
 void onPaint(Graphics g)
          Called by the system to draw the check control.
 void setChecked(boolean checked)
          Sets the checked state of the control.
 void setText(java.lang.String text)
          sets the text that is displayed in the check. added by guich
 java.lang.String toString()
          Returns the string representation of the object.
 
Methods inherited from class waba.ui.Control
addTimer, contains, createGraphics, getAbsoluteRect, getFontMetrics, getNext, getParent, getRect, isEnabled, isVisible, onBoundsChanged, onWindowPaintFinished, postEvent, removeTimer, repaint, repaintNow, setEnabled, setFont, setRect, setRect, setVisible
 
Methods inherited from class java.lang.Object
hashCode
 

Constructor Detail

Check

public Check(java.lang.String text)
Creates a check control displaying the given text.
Method Detail

onEvent

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

setText

public void setText(java.lang.String text)
sets the text that is displayed in the check. added by guich

getText

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

getChecked

public boolean getChecked()
Returns the checked state of the control.

setChecked

public void setChecked(boolean checked)
Sets the checked state of the control.

getPreferredWidth

public int getPreferredWidth()
returns the preffered width of this control. added by guich
Overrides:
getPreferredWidth in class Control

getPreferredHeight

public int getPreferredHeight()
returns the preffered height of this control. added by guich
Overrides:
getPreferredHeight in class Control

drawCheck

public static void drawCheck(Graphics g,
                             boolean checked,
                             int x,
                             int y)
Draws the check box graphic at the given position. The box has 12x12.

onPaint

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

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Returns the string representation of the object.
Overrides:
toString in class java.lang.Object