waba.ui
Class Check

java.lang.Object
  |
  +--waba.ui.Control
        |
        +--waba.ui.Check
Direct Known Subclasses:
Check

public class Check
extends Control

Check is a check control. The text is always right-aligned in the control.

Here is an example showing a check being used:

 public class MyProgram extends MainWindow
 {
    Check check;

    public void onStart()
    {
       add(check = new Check("Check me"), LEFT, AFTER);
    }

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


Fields inherited from class waba.ui.Control
AFTER, appId, appObj, asContainer, asWindow, backColor, backDis, BEFORE, BOTTOM, CENTER, clearValueInt, clearValueStr, enabled, FILL, FIT, fm, fmH, focusLess, focusTraversable, font, foreColor, foreDis, height, highlightRectsCount, isHighlighting, LEFT, parent, PREFERRED, RANGE, RIGHT, SAME, TOP, uiCE, uiFlat, uiPalm, uiVista, visible, width, x, x2, y, y2
 
Constructor Summary
Check(java.lang.String text)
          Creates a check control displaying the given text.
 
Method Summary
 void clear()
          Clears this control, checking it if clearValueInt is 1.
 boolean getChecked()
          Returns the checked state of the control.
 int getPreferredHeight()
          returns the preffered height of this control.
 int getPreferredWidth()
          returns the preffered width of this control.
 java.lang.String getText()
          Gets the text displayed in the check.
protected  void onColorsChanged(boolean colorsChanged)
          Called after a setEnabled, setForeColor and setBackColor and when a control has been added to a Container.
 void onEvent(Event event)
          Called by the system to pass events to the check control.
protected  void onFontChanged()
          Called after a setFont
 void onPaint(Graphics g)
          Called by the system to draw the check control.
static void paintCheck(Graphics g, int fmH, int height)
          Paints a check in the given coordinates.
 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
 
Methods inherited from class waba.ui.Control
addTimer, changeHighlighted, contains, createGraphics, drawHighlight, getAbsoluteRect, getBackColor, getFont, getFontMetrics, getForeColor, getNext, getParent, getParentWindow, getPos, getRect, getSize, isDisplayed, isEnabled, isVisible, onBoundsChanged, onWindowPaintFinished, postEvent, removeTimer, repaint, repaintNow, requestFocus, setBackColor, setBackForeColors, setEnabled, setFocusLess, setFont, setForeColor, setRect, setRect, setRect, setVisible, translateFromOrigin, uiStyleChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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.
Overrides:
getPreferredWidth in class Control

getPreferredHeight

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

onColorsChanged

protected void onColorsChanged(boolean colorsChanged)
Description copied from class: Control
Called after a setEnabled, setForeColor and setBackColor and when a control has been added to a Container. If colorsChanged is true, it was called from setForeColor/setBackColor/Container.add; otherwise, it was called from setEnabled
Overrides:
onColorsChanged in class Control

onFontChanged

protected void onFontChanged()
Description copied from class: Control
Called after a setFont
Overrides:
onFontChanged in class Control

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

paintCheck

public static void paintCheck(Graphics g,
                              int fmH,
                              int height)
Paints a check in the given coordinates. The g must have been translated to destination x,y coordinates.
Parameters:
g - The desired Graphics object where to paint. The forecolor must already be set.
fmH - The fmH member
height - The height of the control. The check will be vertical aligned based on this height.
Since:
SuperWaba 5.5

clear

public void clear()
Clears this control, checking it if clearValueInt is 1.
Overrides:
clear in class Control