public class Slider extends Label
BASELINE, BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, DRAG_REGION_LIKELY_DRAG_X, DRAG_REGION_LIKELY_DRAG_XY, DRAG_REGION_LIKELY_DRAG_Y, DRAG_REGION_NOT_DRAGGABLE, DRAG_REGION_POSSIBLE_DRAG_X, DRAG_REGION_POSSIBLE_DRAG_XY, DRAG_REGION_POSSIBLE_DRAG_Y, LEFT, RIGHT, TOP
Constructor and Description |
---|
Slider()
The default constructor uses internal rendering to draw its state
|
Modifier and Type | Method and Description |
---|---|
void |
addActionListener(ActionListener l)
Action listeners give a more coarse event only when the user lifts the finger from the slider
|
void |
addDataChangedListener(DataChangedListener l)
Adds a listener to data changed events, notice that the status argument to the data change listener
shouldn't be relied upon.
|
boolean |
animate()
Allows the animation to reduce "repaint" calls when it returns false.
|
protected Dimension |
calcPreferredSize()
Return the size we would generally like for the component
|
static Slider |
createInfinite()
Creates an infinite progress slider
|
void |
deinitialize()
Invoked to indicate that the component initialization is being reversed
since the component was detached from the container hierarchy.
|
protected void |
fireClicked()
When working in 3 softbutton mode "fire" key (center softbutton) is sent to this method
in order to allow 3 button devices to work properly.
|
protected String |
formattedValue(int value)
Allows formatting the appearance of the progress when text is drawn on top
|
int |
getIncrements()
The increments when the user presses a key to the left/right/up/down etc.
|
int |
getMaxValue() |
int |
getMinValue() |
int |
getProgress()
Indicates the value of progress made
|
Style |
getStyle()
Returns the current Component Style allowing code to draw the current component, you
should normally use getUnselected/Pressed/DisabledStyle() and not this method since
it will return different values based on component state.
|
Image |
getThumbImage()
The thumb image is drawn on top of the current progress
|
void |
initComponent()
Allows subclasses to bind functionality that relies on fully initialized and
"ready for action" component state
|
boolean |
isEditable()
Indicates the slider is modifyable
|
boolean |
isInfinite()
The infinite slider functionality is used to animate
progress for which there is no defined value.
|
boolean |
isRenderPercentageOnTop()
Indicates that the value of the slider should be rendered with a percentage sign
on top of the slider.
|
boolean |
isRenderValueOnTop() |
protected boolean |
isSelectableInteraction()
This method allows a component to indicate that it is interested in an "implicit" select
command to appear in the "fire" button when 3 softbuttons are defined in a device.
|
protected boolean |
isStickyDrag()
Returns true if the component is interested in receiving drag/pointer release events even
after the gesture exceeded its boundaries.
|
boolean |
isVertical()
Indicates the slider is vertical
|
void |
keyPressed(int code)
If this Component is focused, the key pressed event
will call this method
|
void |
keyReleased(int code)
If this Component is focused, the key released event
will call this method
|
void |
paintComponentBackground(Graphics g)
Paint the progress indicator
|
void |
pointerDragged(int x,
int y)
If this Component is focused, the pointer dragged event
will call this method
|
void |
pointerPressed(int x,
int y)
If this Component is focused, the pointer pressed event
will call this method
|
void |
pointerReleased(int x,
int y)
If this Component is focused, the pointer released event
will call this method
|
void |
refreshTheme(boolean merge)
Makes sure the component is up to date with the current theme, ONLY INVOKE THIS METHOD IF YOU CHANGED THE THEME!
|
void |
removeActionListener(ActionListener l)
Action listeners give a more coarse event only when the user lifts the finger from the slider
|
void |
removeDataChangedListener(DataChangedListener l)
Removes a listener from data changed events, notice that the status argument to the data change listener
shouldn't be relied upon.
|
void |
setEditable(boolean editable)
Indicates the slider is modifyable
|
void |
setIncrements(int increments)
The increments when the user presses a key to the left/right/up/down etc.
|
void |
setInfinite(boolean i)
Activates/disables the infinite slider functionality used to animate
progress for which there is no defined value.
|
void |
setMaxValue(int maxValue) |
void |
setMinValue(int minValue) |
void |
setProgress(int value)
Indicates the value of progress made, this method is thread safe and
can be invoked from any thread although discretion should still be kept
so one thread doesn't regress progress made by another thread...
|
void |
setRenderPercentageOnTop(boolean renderPercentageOnTop)
Indicates that the value of the slider should be rendered with a percentage sign
on top of the slider.
|
void |
setRenderValueOnTop(boolean renderValueOnTop) |
void |
setThumbImage(Image thumbImage)
The thumb image is drawn on top of the current progress
|
void |
setUIID(String id)
This method sets the Component the Unique identifier.
|
void |
setVertical(boolean vertical)
Indicates the slider is vertical
|
protected boolean |
shouldBlockSideSwipe()
A component that might need side swipe such as the slider
could block it from being used for some other purpose when
on top of said component.
|
bindProperty, getAlignment, getBaseline, getBaselineResizeBehavior, getBindablePropertyNames, getBindablePropertyTypes, getBoundPropertyValue, getGap, getIcon, getMask, getMaskedIcon, getMaskName, getPropertyNames, getPropertyTypeNames, getPropertyTypes, getPropertyValue, getShiftMillimeters, getShiftText, getText, getTextPosition, getVerticalAlignment, isDefaultTickerEnabled, isEndsWith3Points, isShouldLocalize, isTickerEnabled, isTickerRunning, paint, paramString, setAlignment, setBoundPropertyValue, setDefaultTickerEnabled, setEndsWith3Points, setGap, setIcon, setMask, setMaskName, setPropertyValue, setShiftMillimeters, setShiftText, setShouldLocalize, setText, setTextPosition, setTickerEnabled, setVerticalAlignment, shouldTickerStart, startTicker, startTicker, stopTicker, unbindProperty
addDragOverListener, addDropListener, addFocusListener, addPointerDraggedListener, addPointerPressedListener, addPointerReleasedListener, addPullToRefresh, addScrollListener, calcScrollSize, cancelRepaints, clearClientProperties, contains, deinitializeCustomStyle, dragEnter, dragExit, draggingOver, dragInitiated, drawDraggedImage, drop, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getBorder, getBottomGap, getBounds, getClientProperty, getCloudBoundProperty, getCloudDestinationProperty, getComponentForm, getComponentState, getDirtyRegion, getDisabledStyle, getDraggedx, getDraggedy, getDragImage, getDragRegionStatus, getDragSpeed, getGridPosX, getGridPosY, getHeight, getLabelForComponent, getName, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getParent, getPreferredH, getPreferredSize, getPreferredW, getPressedStyle, getSameHeight, getSameWidth, getScrollable, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getSideGap, getTensileLength, getUIID, getUIManager, getUnselectedStyle, getVisibleBounds, getWidth, getX, getY, growShrink, handlesInput, hasFocus, initCustomStyle, initLaf, installDefaultPainter, isAlwaysTensile, isCellRenderer, isDragActivated, isDragAndDropOperation, isDraggable, isDragRegion, isDropTarget, isEnabled, isFlatten, isFocusable, isGrabsPointerEvents, isHideInPortrait, isInClippingRegion, isInitialized, isRTL, isScrollable, isScrollableX, isScrollableY, isScrollVisible, isSmoothScrolling, isSnapToGrid, isTactileTouch, isTactileTouch, isTensileDragEnabled, isVisible, keyRepeated, laidOut, longKeyPress, longPointerPress, onScrollX, onScrollY, paintBackground, paintBackgrounds, paintBorder, paintComponent, paintComponent, paintLock, paintLockRelease, paintScrollbars, paintScrollbarX, paintScrollbarY, pinch, pointerDragged, pointerHover, pointerHoverPressed, pointerHoverReleased, pointerPressed, pointerReleased, putClientProperty, refreshTheme, refreshTheme, removeDragOverListener, removeDropListener, removeFocusListener, removePointerDraggedListener, removePointerPressedListener, removePointerReleasedListener, removeScrollListener, repaint, repaint, requestFocus, resetFocusable, scrollRectToVisible, scrollRectToVisible, setAlwaysTensile, setCellRenderer, setCloudBoundProperty, setCloudDestinationProperty, setComponentState, setDirtyRegion, setDisabledStyle, setDraggable, setDropTarget, setEnabled, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHideInPortrait, setInitialized, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setPreferredH, setPreferredSize, setPreferredW, setPressedStyle, setRTL, setSameHeight, setSameWidth, setScrollAnimationSpeed, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setShouldCalcPreferredSize, setSize, setSmoothScrolling, setSnapToGrid, setTactileTouch, setTensileDragEnabled, setTensileLength, setUnselectedStyle, setVisible, setWidth, setX, setY, styleChanged, toString
public Slider()
public void setUIID(String id)
Component
protected boolean isStickyDrag()
Component
isStickyDrag
in class Component
public void initComponent()
Component
initComponent
in class Component
public void deinitialize()
Component
deinitialize
in class Component
public boolean animate()
Animation
Display
class.public boolean isInfinite()
public void setInfinite(boolean i)
i
- true for infinite progresspublic static Slider createInfinite()
public void refreshTheme(boolean merge)
Component
refreshTheme
in class Component
merge
- indicates if the current styles should be merged with the new stylespublic int getProgress()
public void setProgress(int value)
value
- new value for progressprotected String formattedValue(int value)
value
- the value of the sliderpublic Style getStyle()
Component
protected Dimension calcPreferredSize()
calcPreferredSize
in class Label
public void paintComponentBackground(Graphics g)
g
- the component graphicspublic boolean isVertical()
public void setVertical(boolean vertical)
vertical
- true if the slider is verticalpublic boolean isEditable()
public void setEditable(boolean editable)
editable
- true if the slider is editablepublic void pointerPressed(int x, int y)
Component
pointerPressed
in class Component
x
- the pointer x coordinatey
- the pointer y coordinatepublic void pointerDragged(int x, int y)
Component
pointerDragged
in class Component
x
- the pointer x coordinatey
- the pointer y coordinateprotected void fireClicked()
Component
fireClicked
in class Component
protected boolean isSelectableInteraction()
Component
isSelectableInteraction
in class Component
public void pointerReleased(int x, int y)
Component
pointerReleased
in class Component
x
- the pointer x coordinatey
- the pointer y coordinatepublic void keyReleased(int code)
Component
keyReleased
in class Component
code
- the key code value to indicate a physical key.public void keyPressed(int code)
Component
keyPressed
in class Component
code
- the key code value to indicate a physical key.public int getIncrements()
public void setIncrements(int increments)
increments
- increment valuepublic void addDataChangedListener(DataChangedListener l)
l
- new listenerpublic void removeDataChangedListener(DataChangedListener l)
l
- listener to removepublic void addActionListener(ActionListener l)
l
- the listenerpublic void removeActionListener(ActionListener l)
l
- the listenerpublic boolean isRenderPercentageOnTop()
public void setRenderPercentageOnTop(boolean renderPercentageOnTop)
renderPercentageOnTop
- true to render percentagespublic boolean isRenderValueOnTop()
public void setRenderValueOnTop(boolean renderValueOnTop)
renderValueOnTop
- the renderValueOnTop to setpublic int getMaxValue()
public void setMaxValue(int maxValue)
maxValue
- the maxValue to setpublic int getMinValue()
public void setMinValue(int minValue)
minValue
- the minValue to setpublic Image getThumbImage()
public void setThumbImage(Image thumbImage)
thumbImage
- the thumbImage to setprotected boolean shouldBlockSideSwipe()
Component
shouldBlockSideSwipe
in class Component