Package totalcross.ui
Class ArrowButton
- java.lang.Object
-
- totalcross.ui.gfx.GfxSurface
-
- totalcross.ui.Control
-
- totalcross.ui.Button
-
- totalcross.ui.ArrowButton
-
- All Implemented Interfaces:
TextControl
public class ArrowButton extends Button
A class used to display a Button with an arrow inside.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class totalcross.ui.Control
Control.TranslucentShape
-
-
Field Summary
Fields Modifier and Type Field Description intarrowColorThe arrow's color.protected bytedirectionGraphics.ARROW_UP,Graphics.ARROW_DOWN,Graphics.ARROW_LEFT, orGraphics.ARROW_RIGHT.protected intdkkThe newly assigned arrow size.protected intkkThe current arrow size.protected intprefWHprefWH the desired arrow width/height.protected intxxThe x position.protected intyyThe y position.-
Fields inherited from class totalcross.ui.Button
armed, AUTO_DELAY, autoRepeat, border, BORDER_3D, BORDER_3D_HORIZONTAL_GRADIENT, BORDER_3D_VERTICAL_GRADIENT, BORDER_GRAY_IMAGE, BORDER_NONE, BORDER_OUTLINED, BORDER_ROUND, BORDER_SIMPLE, borderColor, borderColor3DG, borderWidth3DG, bottomColor3DG, CENTRALIZE, commonGap, cornerRadius3DG, currentFrame, disabledColor, drawBordersIfTransparentBackground, fColor, fillWhenPressedOnTransparentBackground, flatBackground, fourColors, hightlightColor, imageHeightFactor, img, img0, imgDis, INITIAL_DELAY, isSticky, ix0, iy0, paddingBottom, paddingLeft, paddingRight, paddingTop, pressColor, pressedImage, relativeToText, roundBorderFactor, shiftOnPress, text, topColor3DG, tx0, ty0, underlinedText
-
Fields inherited from class totalcross.ui.Control
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 Summary
Constructors Constructor Description ArrowButton(byte direction, int prefWH, int arrowColor)Constructs anArrowButton.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetPreferredHeight()Returns the preferred height of this control.intgetPreferredWidth()Returns the preferred width of this control.protected voidonBoundsChanged(boolean screenChanged)Called after asetRect().voidonPaint(Graphics g)Called by the system to draw theArrowButton.voidsetArrowSize(int kk)Sets the arrow size.voidsetBorder(byte border)Sets the style of the border.java.lang.StringtoString()Returns a string representation of the object.-
Methods inherited from class totalcross.ui.Button
getImage, getText, isPressed, onColorsChanged, onEvent, onFontChanged, paintBackground, paintImage, paintText, press, setImage, setNinePatch, setNinePatch, setPressedColor, setText, simulatePress
-
Methods inherited from class totalcross.ui.Control
_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, 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, setRect, setRect, setRect, setRect, setSet, setTextShadowColor, setTranslucent, setVisible, showTip, takeInitialScreenShot, takeScreenShot, translateFromOrigin, uiStyleChanged, updateScreen, updateTemporary, willOpenKeyboard
-
-
-
-
Field Detail
-
direction
protected byte direction
Graphics.ARROW_UP,Graphics.ARROW_DOWN,Graphics.ARROW_LEFT, orGraphics.ARROW_RIGHT.
-
prefWH
protected int prefWH
prefWH the desired arrow width/height. The effective arrow's size will be computed based in the current width/height.
-
xx
protected int xx
The x position.
-
yy
protected int yy
The y position.
-
kk
protected int kk
The current arrow size.
-
dkk
protected int dkk
The newly assigned arrow size.
-
arrowColor
public int arrowColor
The arrow's color.
-
-
Constructor Detail
-
ArrowButton
public ArrowButton(byte direction, int prefWH, int arrowColor)Constructs anArrowButton.- Parameters:
direction-Graphics.ARROW_UP,Graphics.ARROW_DOWN,Graphics.ARROW_LEFT, orGraphics.ARROW_RIGHT.prefWH- The desired arrow width/height. The effective arrow's size will be computed based in the current width/height.arrowColor- The arrow color. Can be changed by setting thearrowColorfield.
-
-
Method Detail
-
getPreferredWidth
public int getPreferredWidth()
Returns the preferred width of this control.- Overrides:
getPreferredWidthin classButton- Returns:
- The preferred width of this control.
-
getPreferredHeight
public int getPreferredHeight()
Returns the preferred height of this control.- Overrides:
getPreferredHeightin classButton- Returns:
- The preferred height of this control.
-
setBorder
public void setBorder(byte border)
Sets the style of the border.- Overrides:
setBorderin classButton- Parameters:
border- One out ofButton.BORDER_NONE,Button.BORDER_SIMPLE,Button.BORDER_3D,Button.BORDER_3D_HORIZONTAL_GRADIENT,Button.BORDER_3D_VERTICAL_GRADIENT, orButton.BORDER_GRAY_IMAGE.- See Also:
Button.BORDER_NONE,Button.BORDER_SIMPLE,Button.BORDER_3D,Button.BORDER_3D_HORIZONTAL_GRADIENT,Button.BORDER_3D_VERTICAL_GRADIENT,Button.BORDER_GRAY_IMAGE
-
setArrowSize
public void setArrowSize(int kk)
Sets the arrow size.- Parameters:
kk- The new size.
-
onBoundsChanged
protected void onBoundsChanged(boolean screenChanged)
Called after asetRect().- Overrides:
onBoundsChangedin classButton- Parameters:
screenChanged- If the bounds was changed due to a screen change (rotation, collapse).
-
onPaint
public void onPaint(Graphics g)
Called by the system to draw theArrowButton.
-
toString
public java.lang.String toString()
Returns a string representation of the object.- Overrides:
toStringin classjava.lang.Object- Returns:
- The string representation of the haired button plus its direction.
-
-