Package totalcross.ui
Class Slider
- java.lang.Object
-
- totalcross.ui.gfx.GfxSurface
-
- totalcross.ui.Control
-
- totalcross.ui.Container
-
- totalcross.ui.ScrollBar
-
- totalcross.ui.Slider
-
- All Implemented Interfaces:
ControlAnimation.AnimationFinished,PathAnimation.SetPosition
public class Slider extends ScrollBar
Slider is a simple slider. You can set some properties of the slider, like drawTicks, invertDirection and drawFilledArea; read the javadocs of each for more information. You can change the thumb size by setting theminDragBarSizepublic field and then call setValues or setMaximum or setMinimum method (value must always be ODD!).- Since:
- TotalCross 1.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class totalcross.ui.Control
Control.TranslucentShape
-
-
Field Summary
Fields Modifier and Type Field Description intbarHeightSize of the bar when it is using MaterialUIintcircleColorThe color of the circle you drag to change the slider value.booleandrawFilledAreaSet to false to don't draw the filled area.booleandrawTicksSet to true to draw the ticks.booleaninvertDirectionInverts the direction of the marker.intsliderColorThe color of the sliderintticksColorThe color of the slider ticks-
Fields inherited from class totalcross.ui.ScrollBar
AUTO_DELAY, bColor, blockIncrement, btnDec, btnInc, btnWH, directMove, disableBlockIncrement, dragBarMax, dragBarMin, dragBarPos, dragBarSize, enableAutoScroll, extraSize, fourColors, HORIZONTAL, INITIAL_DELAY, liveScrolling, maximum, midBarSize, minDragBarSize, minimum, npPartsHandle, sbColor, sbColorDis, sfColor, size, startDragPos, unitIncrement, value, valuesPerPixel, VERTICAL, verticalBar, visibleItems
-
Fields inherited from class totalcross.ui.Container
alwaysEraseBackground, BACKGROUND_CYLINDRIC_SHADED, BACKGROUND_SHADED, BACKGROUND_SHADED_INV, BACKGROUND_SOLID, backgroundStyle, BORDER_LOWERED, BORDER_NONE, BORDER_RAISED, BORDER_ROUNDED, BORDER_SIMPLE, BORDER_TOP, borderColor, children, controlFound, finishedStart, ignoreOnAddAgain, ignoreOnRemove, insets, lastH, lastScreenWidth, lastW, lastX, lastY, npback, numChildren, started, tabOrder, tail, TRANSITION_CLOSE, TRANSITION_FADE, TRANSITION_NONE, TRANSITION_OPEN, TRANSITION_TIME, transitionEffect
-
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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetDragBarPos(int value)Returns the drag bar position.intgetPreferredHeight()If this is a horizontal scroll bar, i strongly suggest you use PREFERRED in your control's height (with small adjustments)intgetPreferredWidth()If this is a vertical scroll bar, i strongly suggest you use PREFERRED in your control's width (with small adjustments).voidonColorsChanged(boolean b)Called after a setEnabled, setForeColor and setBackColor and when a control has been added to a Container.voidonFontChanged()Called after a setFontvoidonPaint(Graphics g)Draws the border (if any).protected voidrecomputeParams(boolean justValue)protected voidupdateValue(int pos)-
Methods inherited from class totalcross.ui.ScrollBar
blockScroll, clear, getBlockIncrement, getMaximum, getMinimum, getUnitIncrement, getValue, getVisibleItems, handleGeographicalFocusChangeKeys, onAnimationFinished, onBoundsChanged, onEvent, setBlockIncrement, setEnabled, setHighlighting, setLiveScrolling, setMaximum, setMinimum, setNinePatchHandle, setPos, setUnitIncrement, setValue, setValues, setVisibleItems, tempShow
-
Methods inherited from class totalcross.ui.Container
add, add, add, add, add, applyTransitionEffect, broadcastEvent, fillBackground, findChild, findNearestChild, findNextFocusControl, getBorderStyle, getChildren, getChildrenCount, getClientRect, getClientRect, getFirstChild, getFocusableControls, getInsets, incLastX, incLastY, initUI, isPressed, moveFocusToNextControl, moveFocusToNextEditable, onAddAgain, onRemove, onSwapFinished, paintChildren, remove, removeAll, resize, resizeHeight, resizeWidth, setBorderStyle, setFocusTraversable, setInsets, setNextTransitionEffect, setPressColor, setPressed, swapToTopmostWindow
-
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, 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, 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, setFloating, setFocusLess, setFont, setForeColor, setNinePatch, setNinePatch, setRect, setRect, setRect, setRect, setSet, setTextShadowColor, setTranslucent, setVisible, showTip, takeInitialScreenShot, takeScreenShot, translateFromOrigin, uiStyleChanged, updateScreen, updateTemporary, willOpenKeyboard
-
-
-
-
Field Detail
-
invertDirection
public boolean invertDirection
Inverts the direction of the marker. You must set this property before calling setValues (or the other min/max/value/visibleItems set methods) for the first time. For material UI, inverts the color area.
-
drawTicks
public boolean drawTicks
Set to true to draw the ticks. Should be set only when maximum-minimum is much smaller than width. You must set this property before calling setValues (or the other min/max/value/visibleItems set methods) for the first time.
-
drawFilledArea
public boolean drawFilledArea
Set to false to don't draw the filled area. You must set this property before calling setValues (or the other min/max/value/visibleItems set methods) for the first time.
-
sliderColor
public int sliderColor
The color of the slider
-
circleColor
public int circleColor
The color of the circle you drag to change the slider value.
-
ticksColor
public int ticksColor
The color of the slider ticks
-
barHeight
public int barHeight
Size of the bar when it is using MaterialUI
-
-
Constructor Detail
-
Slider
public Slider()
Constructs a HORIZONTAL Slider.
-
Slider
public Slider(byte orientation)
Constructs a Slider with the given orientation.- See Also:
ScrollBar.VERTICAL,ScrollBar.HORIZONTAL
-
-
Method Detail
-
recomputeParams
protected void recomputeParams(boolean justValue)
- Overrides:
recomputeParamsin classScrollBar
-
onColorsChanged
public void onColorsChanged(boolean b)
Description copied from class:ControlCalled after a setEnabled, setForeColor and setBackColor and when a control has been added to a Container. If colorsChanged is true, it was called from setForeColor/setBackColor/Container.add; otherwise, it was called from setEnabled- Overrides:
onColorsChangedin classScrollBar
-
onFontChanged
public void onFontChanged()
Description copied from class:ControlCalled after a setFont- Overrides:
onFontChangedin classScrollBar
-
getDragBarPos
public int getDragBarPos(int value)
Returns the drag bar position.
-
onPaint
public void onPaint(Graphics g)
Description copied from class:ContainerDraws the border (if any). If you override this method, be sure to callsuper.onPaint(g);, or the border will not be drawn.
-
getPreferredWidth
public int getPreferredWidth()
Description copied from class:ScrollBarIf this is a vertical scroll bar, i strongly suggest you use PREFERRED in your control's width (with small adjustments).- Overrides:
getPreferredWidthin classScrollBar
-
getPreferredHeight
public int getPreferredHeight()
Description copied from class:ScrollBarIf this is a horizontal scroll bar, i strongly suggest you use PREFERRED in your control's height (with small adjustments)- Overrides:
getPreferredHeightin classScrollBar
-
updateValue
protected void updateValue(int pos)
- Overrides:
updateValuein classScrollBar
-
-