|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.j4me.ui.components.Component
org.j4me.ui.components.CheckBox
public class CheckBox
The CheckBox
component lets a user turn an option on or off.
Multiple check box components can be placed sequentially to create
a list of choices where zero or more can be chosen.
Field Summary |
---|
Fields inherited from class org.j4me.ui.components.Component |
---|
container, HIGHLIGHTED_BORDER_WIDTH |
Constructor Summary | |
---|---|
CheckBox()
Constructs a CheckBox component. |
Method Summary | |
---|---|
boolean |
acceptsInput()
Tells if this component accepts user input or not. |
java.lang.String |
getLabel()
Gets the value of the text that appears to the right of the check box. |
protected int[] |
getPreferredComponentSize(Theme theme,
int viewportWidth,
int viewportHeight)
Returns the dimensions of the check box. |
protected void |
hideNotify()
An event raised whenever the component is removed from the screen. |
boolean |
isChecked()
Returns true if the box is checked or false if it is
not. |
void |
keyPressed(int keyCode)
Called when a key is pressed. |
protected void |
paintComponent(javax.microedition.lcdui.Graphics g,
Theme theme,
int width,
int height,
boolean selected)
Paints the check box component. |
void |
pointerPressed(int x,
int y)
Called when the pointer is pressed. |
void |
setChecked(boolean checked)
Checks or unchecks the box. |
void |
setLabel(java.lang.String value)
Sets the text that appears next to the check box. |
protected void |
showNotify()
An event raised whenever the component is made visible on the screen. |
Methods inherited from class org.j4me.ui.components.Component |
---|
getHeight, getHorizontalAlignment, getPreferredSize, getScreen, getWidth, getX, getY, invalidate, isShown, keyReleased, keyRepeated, paint, paintRect, pointerDragged, pointerReleased, repaint, setHorizontalAlignment, visible |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CheckBox()
CheckBox
component.
Method Detail |
---|
public java.lang.String getLabel()
null
but may be the empty string "".public void setLabel(java.lang.String value)
value
- is the text that appears to the right of the check box.
A null
is treated as the empty string "".public boolean isChecked()
true
if the box is checked or false
if it is
not.
true
if the box is checked or false
if it is
not.public void setChecked(boolean checked)
checked
- when true
checks the box; when false
unchecks it.protected void showNotify()
paintComponent
method.
showNotify
in class Component
protected void hideNotify()
hideNotify
in class Component
protected void paintComponent(javax.microedition.lcdui.Graphics g, Theme theme, int width, int height, boolean selected)
paintComponent
in class Component
g
- is the Graphics
object to be used for rendering the item.theme
- is the application's theme. Use it to get fonts and colors.width
- is the width, in pixels, to paint the component.height
- is the height, in pixels, to paint the component.selected
- is true
when this components is currently selected
and false
when it is not.Component.paintComponent(javax.microedition.lcdui.Graphics, org.j4me.ui.Theme, int, int, boolean)
protected int[] getPreferredComponentSize(Theme theme, int viewportWidth, int viewportHeight)
getPreferredComponentSize
in class Component
theme
- is the application's Theme
.viewportWidth
- is the width of the viewable area, in pixels,
the component can use.viewportHeight
- is the height of the viewable area, in pixels,
the component can use.
Component.getPreferredComponentSize(org.j4me.ui.Theme, int, int)
public boolean acceptsInput()
Component
The default implementation returns false
. Override this method
to return true
if the component accepts input.
acceptsInput
in class Component
true
because this component accepts user input.public void keyPressed(int keyCode)
keyPressed
in class Component
keyCode
- is the key code of the key that was pressed.public void pointerPressed(int x, int y)
pointerPressed
in class Component
x
- is the horizontal location where the pointer was pressed
relative to the top-left corner of the component.y
- is the vertical location where the pointer was pressed
relative to the top-left corner of the component.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |