public class Switch extends Control implements PathAnimation.SetPosition, ControlAnimation.AnimationFinished
Control.TranslucentShape
Modifier and Type | Field and Description |
---|---|
static int |
ANIMATION_TIME
The animation time.
|
boolean |
centerText
Set to true to center text instead of moving it to left or right
|
int |
colorBackOff
Text color to draw when on background or foreground, and when this switch is on or off
|
int |
colorBackOn
Text color to draw when on background or foreground, and when this switch is on or off
|
int |
colorBallOff
Colors used in material
|
int |
colorBallOn
Colors used in material
|
int |
colorBarOff
Colors used in material
|
int |
colorBarOn
Colors used in material
|
int |
colorForeOff
Text color to draw when on background or foreground, and when this switch is on or off
|
int |
colorForeOn
Text color to draw when on background or foreground, and when this switch is on or off
|
java.lang.String |
textBackOff
Text to draw when on background or foreground, and when this switch is on or off
|
java.lang.String |
textBackOn
Text to draw when on background or foreground, and when this switch is on or off
|
java.lang.String |
textForeOff
Text to draw when on background or foreground, and when this switch is on or off
|
java.lang.String |
textForeOn
Text to draw when on background or foreground, and when this switch is on or off
|
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 |
---|
Switch()
Constructs a switch of iOS type.
|
Switch(boolean androidType)
Constructs a switch of the given type.
|
Modifier and Type | Method and Description |
---|---|
int |
getPreferredHeight()
Returns the preferred height of this control.
|
int |
getPreferredWidth()
Returns the preferred width of this control.
|
boolean |
isOn()
Returns true if this switch is ON.
|
void |
moveSwitch(boolean toLeft) |
void |
onAnimationFinished(ControlAnimation anim) |
void |
onBoundsChanged(boolean b)
Called after a setRect.
|
void |
onColorsChanged(boolean b)
Called after a setEnabled, setForeColor and setBackColor and when a control has
been added to a Container.
|
void |
onEvent(Event event)
Called to process key, pen, control and other posted events.
|
void |
onPaint(Graphics g)
Called to draw the control.
|
void |
setOn(boolean b)
Change the on/off state.
|
void |
setPos(int x,
int y)
Used by animation
|
_onEvent, addEnabledStateListener, addFocusListener, addFontChangeHandler, addGridListener, addHandler, addHighlightListener, addKeyListener, addListContainerListener, addMouseListener, addMultiTouchListener, addPenListener, addPressListener, addPushNotificationListener, addSizeChangeHandler, addTimer, addTimer, addTimerListener, addValueChangeHandler, addWindowListener, bringToFront, changeHighlighted, clear, 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, onFontChanged, 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
public static int ANIMATION_TIME
public java.lang.String textBackOn
public java.lang.String textForeOn
public java.lang.String textBackOff
public java.lang.String textForeOff
public int colorBackOn
public int colorForeOn
public int colorBackOff
public int colorForeOff
public int colorBallOn
public int colorBallOff
public int colorBarOn
public int colorBarOff
public boolean centerText
public Switch()
public Switch(boolean androidType)
public void onBoundsChanged(boolean b)
Control
onBoundsChanged
in class Control
b
- If the bounds were changed due to a screen change (rotation, collapse)public void onColorsChanged(boolean b)
Control
onColorsChanged
in class Control
public void setOn(boolean b)
public boolean isOn()
public void moveSwitch(boolean toLeft)
public void setPos(int x, int y)
setPos
in interface PathAnimation.SetPosition
public void onPaint(Graphics g)
Control
public void onEvent(Event event)
Control
public int getPreferredHeight()
Control
getPreferredHeight
in class Control
public int getPreferredWidth()
Control
getPreferredWidth
in class Control
public void onAnimationFinished(ControlAnimation anim)
onAnimationFinished
in interface ControlAnimation.AnimationFinished