public class Check extends Control implements TextControl, MaterialEffect.SideEffect
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
Control.TranslucentShape
Modifier and Type | Field and Description |
---|---|
boolean |
autoSplit
Set to true to let the Check split its text based on the width every time its width
changes.
|
int |
checkColor
Set to the color of the check, if you want to make it different of the foreground color.
|
int |
checkSize
Sets the size of the check.
|
int |
disabledColor
The disable color used to fill the background color when disabled.
|
boolean |
leftJustify
Deprecated.
Now the align is always at left
|
int |
textColor
Sets the text color of the check.
|
int |
textLeftGap
Change to modify the gap value between the checkbox and the text.
|
AFTER, alphaValue, appId, appObj, asContainer, asWindow, backColor, BEFORE, BOTTOM, BOTTOM_OF, BRIGHTER_BACKGROUND, callListenersOnAllTargets, CENTER, CENTER_OF, clearValueInt, clearValueStr, DARKER_BACKGROUND, DP, effect, enableUpdateScreen, esce, eventsEnabled, FILL, fillColor, FIT, floating, fm, fmH, focusHandler, focusLess, focusOnPenDown, focusTraversable, font, FONTSIZE, foreColor, height, ignoreInsets, isHighlighting, isTablet, KEEP, keepDisabled, keepEnabled, LEFT, next, nextTabControl, npParts, offscreen, offscreen0, onEventFirst, parent, PARENTSIZE, PARENTSIZEMAX, PARENTSIZEMIN, PREFERRED, prev, RANGE, repositionAllowed, RIGHT, RIGHT_OF, SAME, SCREENSIZE, SCREENSIZEMAX, SCREENSIZEMIN, setFont, setH, setRel, setW, setX, SETX_NOT_SET, setY, tempW, textShadowColor, TOP, translucentShape, transparentBackground, uiAdjustmentsBasedOnFontHeightIsSupported, uiAndroid, UICONST, uiFlat, uiHolo, uiMaterial, uiVista, visible, width, WILL_RESIZE, x, y
Constructor and Description |
---|
Check()
Creates a check control.
|
Check(java.lang.String text)
Creates a check control displaying the given text.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears this control, checking it if clearValueInt is 1.
|
int |
getMaxTextWidth()
Returns the maximum text width for the lines of this Label.
|
int |
getPreferredHeight()
Returns the preferred height of this control.
|
int |
getPreferredWidth()
Returns the preferred width of this control.
|
java.lang.String |
getText()
Gets the text displayed in the check.
|
boolean |
isChecked()
Returns the checked state of the control.
|
protected void |
onBoundsChanged(boolean screenChanged)
Called after a setRect.
|
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 |
setChecked(boolean checked,
boolean sendPress)
Sets the checked state of the control, and send the press event if desired.
|
void |
setInsets(int left,
int right,
int top,
int bottom)
Modify the check insets.
|
void |
setText(java.lang.String text)
Sets the text that is displayed in the check.
|
void |
sidePaint(Graphics g,
int alpha) |
void |
sideStart() |
void |
sideStop() |
void |
split(int maxWidth)
Splits the text to the given width.
|
_onEvent, addEnabledStateListener, addFocusListener, addFontChangeHandler, addGridListener, addHandler, addHighlightListener, addKeyListener, addListContainerListener, addMouseListener, addMultiTouchListener, addPenListener, addPressListener, addPushNotificationListener, addSizeChangeHandler, addTimer, addTimer, addTimerListener, addValueChangeHandler, addWindowListener, bringToFront, changeHighlighted, contains, drawTranslucentBackground, getAbsoluteRect, getBackColor, getDoEffect, getEffectH, getEffectW, getEffectX, getEffectY, getEventListeners, getFont, getForeColor, getGap, getGraphics, getHeight, getNext, getParent, getParentWindow, getPos, getPressedEvent, getPrev, getRect, getSize, getTextShadowColor, getWidth, getX, getX2, getY, getY2, hadParentScrolled, handleGeographicalFocusChangeKeys, hasFocus, internalSetEnabled, intXYWH, isActionEvent, isChildOf, isDisplayed, isEnabled, isFloating, isInsideOrNear, isObscured, isTopMost, isVisible, isVisibleAndInside, onWindowPaintFinished, post, postEvent, postPressedEvent, releaseScreenShot, removeEnabledStateListener, removeFocusListener, removeGridListener, removeHandler, removeHighlightListener, removeKeyListener, removeListContainerListener, removeMouseListener, removeMultiTouchListener, removePenListener, removePressListener, removePushNotificationListener, removeTimer, removeTimerListener, removeWindowListener, repaint, repaintNow, reposition, reposition, repositionChildren, requestFocus, resetSetPositions, resetStyle, safeRepaintNow, safeUpdateScreen, sendToBack, setBackColor, setBackForeColors, setDoEffect, setEnabled, setFloating, setFocusLess, setFont, setForeColor, setNinePatch, setNinePatch, setRect, setRect, setRect, setRect, setSet, setTextShadowColor, setTranslucent, setVisible, showTip, takeInitialScreenShot, takeScreenShot, translateFromOrigin, uiStyleChanged, updateScreen, updateTemporary, willOpenKeyboard
@Deprecated public boolean leftJustify
public int textColor
public int checkColor
public int disabledColor
public boolean autoSplit
public int textLeftGap
public int checkSize
public Check()
public Check(java.lang.String text)
public void setInsets(int left, int right, int top, int bottom)
public void onEvent(Event event)
public void setText(java.lang.String text)
setText
in interface TextControl
public java.lang.String getText()
getText
in interface TextControl
public boolean isChecked()
public void setChecked(boolean checked)
public void setChecked(boolean checked, boolean sendPress)
public int getMaxTextWidth()
public int getPreferredWidth()
getPreferredWidth
in class Control
public int getPreferredHeight()
getPreferredHeight
in class Control
protected void onColorsChanged(boolean colorsChanged)
Control
onColorsChanged
in class Control
public void onPaint(Graphics g)
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()
public void split(int maxWidth)
autoSplit
protected void onFontChanged()
Control
onFontChanged
in class Control
protected void onBoundsChanged(boolean screenChanged)
Control
onBoundsChanged
in class Control
screenChanged
- If the bounds were changed due to a screen change (rotation, collapse)public void sideStart()
sideStart
in interface MaterialEffect.SideEffect
public void sideStop()
sideStop
in interface MaterialEffect.SideEffect
public void sidePaint(Graphics g, int alpha)
sidePaint
in interface MaterialEffect.SideEffect