|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
totalcross.lang.Objecttotalcross.ui.gfx.GfxSurface
totalcross.ui.Control
totalcross.ui.Check
public class Check
Check is a control with a box and a check inside of it when the state is checked.
Here is an example showing a check being used:
public class MyProgram extends MainWindow
{
Check check;
public void initUI()
{
add(check = new Check("Check me"), LEFT, AFTER);
}
public void onEvent(Event event)
{
if (event.type == ControlEvent.PRESSED && event.target == check)
{
bool checked = check.isChecked();
... handle check being pressed
| Field Summary | |
|---|---|
boolean |
leftJustify
Set to true to left-justify the text in the control. |
| Fields inherited from class totalcross.ui.Control |
|---|
AFTER, appId, appObj, asContainer, asWindow, backColor, BEFORE, BOTTOM, BOTTOM_OF, CENTER, CENTER_OF, clearValueInt, clearValueStr, enabled, enableUpdateScreen, FILL, FIT, fm, fmH, focusHandler, focusLess, focusOnPenDown, focusTraversable, font, foreColor, height, isHighlighting, KEEP, LEFT, onEventFirst, parent, PREFERRED, RANGE, repositionAllowed, RIGHT, RIGHT_OF, SAME, setFont, setH, setRel, setW, setX, setY, TOP, transparentBackground, uiCE, uiFlat, uiPalm, uiVista, visible, width, WILL_RESIZE, x, y |
| Constructor Summary | |
|---|---|
Check(String text)
Creates a check control displaying the given text. |
|
| Method Summary | |
|---|---|
void |
clear()
Clears this control, checking it if clearValueInt is 1. |
int |
getPreferredHeight()
returns the preffered height of this control. |
int |
getPreferredWidth()
returns the preffered width of this control. |
String |
getText()
Gets the text displayed in the check. |
boolean |
isChecked()
Returns the checked state of the control. |
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(String text)
Sets the text that is displayed in the check. |
| Methods inherited from class totalcross.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public boolean leftJustify
| Constructor Detail |
|---|
public Check(String text)
| Method Detail |
|---|
public void onEvent(Event event)
onEvent in class Controlevent - the event to processEvent,
KeyEvent,
PenEventpublic void setText(String text)
public String getText()
public boolean isChecked()
public void setChecked(boolean checked)
public int getPreferredWidth()
getPreferredWidth in class Controlpublic int getPreferredHeight()
getPreferredHeight in class Controlprotected void onColorsChanged(boolean colorsChanged)
Control
onColorsChanged in class Controlprotected void onFontChanged()
Control
onFontChanged in class Controlpublic void onPaint(Graphics g)
onPaint in class Controlg - the graphics object for drawingGraphics
public static void paintCheck(Graphics g,
int fmH,
int height)
g - The desired Graphics object where to paint. The forecolor must already be set.fmH - The fmH memberheight - The height of the control. The check will be vertical aligned based on this height.public void clear()
clear in class Control
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||