public class Slider extends ProgressBar
ChangeListener.ChangeEvent
is fired when the slider knob is moved. Canceling the event will move the knob to where it was previously.
For a horizontal progress bar, its preferred height is determined by the larger of the knob and background, and the preferred width is 140, a relatively arbitrary size. These parameters are reversed for a vertical progress bar.
Modifier and Type | Class and Description |
---|---|
static class |
Slider.SliderStyle
The style for a slider, see
Slider . |
ProgressBar.ProgressBarStyle
Constructor and Description |
---|
Slider(float min,
float max,
float stepSize,
boolean vertical,
Skin skin) |
Slider(float min,
float max,
float stepSize,
boolean vertical,
Skin skin,
String styleName) |
Slider(float min,
float max,
float stepSize,
boolean vertical,
Slider.SliderStyle style)
Creates a new slider.
|
Modifier and Type | Method and Description |
---|---|
Slider.SliderStyle |
getStyle()
Returns the slider's style.
|
boolean |
isDragging()
Returns true if the slider is being dragged.
|
boolean |
isOver() |
void |
setButton(int button)
Sets the mouse button, which can trigger a change of the slider.
|
void |
setSnapToValues(float[] values,
float threshold)
Will make this progress bar snap to the specified values, if the knob is within the threshold.
|
void |
setVisualInterpolationInverse(Interpolation interpolation)
Sets the inverse interpolation to use for display.
|
void |
setVisualPercent(float percent)
Sets the value using the specified visual percent.
|
act, draw, getMaxValue, getMinValue, getPercent, getPrefHeight, getPrefWidth, getStepSize, getValue, getVisualPercent, getVisualValue, isAnimating, isDisabled, isVertical, setAnimateDuration, setAnimateInterpolation, setDisabled, setProgrammaticChangeEvents, setRange, setRound, setStepSize, setStyle, setValue, setVisualInterpolation, updateVisualValue
getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, invalidate, invalidateHierarchy, layout, needsLayout, pack, setFillParent, setLayoutEnabled, validate
addAction, addCaptureListener, addListener, ancestorsVisible, ascendantsVisible, clear, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, debug, drawDebug, fire, firstAscendant, getActions, getCaptureListeners, getColor, getDebug, getHeight, getListeners, getName, getOriginX, getOriginY, getParent, getRight, getRotation, getScaleX, getScaleY, getStage, getTop, getTouchable, getUserObject, getWidth, getX, getX, getY, getY, getZIndex, hasActions, hasKeyboardFocus, hasParent, hasScrollFocus, hit, isAscendantOf, isDescendantOf, isTouchable, isTouchFocusListener, isTouchFocusTarget, isVisible, localToActorCoordinates, localToAscendantCoordinates, localToParentCoordinates, localToScreenCoordinates, localToStageCoordinates, moveBy, notify, parentToLocalCoordinates, remove, removeAction, removeCaptureListener, removeListener, rotateBy, scaleBy, scaleBy, screenToLocalCoordinates, setBounds, setColor, setColor, setDebug, setHeight, setName, setOrigin, setOrigin, setOriginX, setOriginY, setPosition, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setTouchable, setUserObject, setVisible, setWidth, setX, setX, setY, setY, setZIndex, sizeBy, sizeBy, stageToLocalCoordinates, toBack, toFront, toString
public Slider(float min, float max, float stepSize, boolean vertical, Skin skin)
public Slider(float min, float max, float stepSize, boolean vertical, Skin skin, String styleName)
public Slider(float min, float max, float stepSize, boolean vertical, Slider.SliderStyle style)
NinePatch
or slider handle TextureRegion
. The min and max values
determine the range the values of this slider can take on, the stepSize parameter specifies the distance between individual
values. E.g. min could be 4, max could be 10 and stepSize could be 0.2, giving you a total of 30 values, 4.0 4.2, 4.4 and so
on.min
- the minimum valuemax
- the maximum valuestepSize
- the step size between valuesstyle
- the Slider.SliderStyle
public Slider.SliderStyle getStyle()
ProgressBar.setStyle(ProgressBarStyle)
is called.getStyle
in class ProgressBar
public boolean isOver()
public void setSnapToValues(@Null float[] values, float threshold)
values
- May be null.public boolean isDragging()
public void setButton(int button)
public void setVisualInterpolationInverse(Interpolation interpolation)
visual interpolation
.public void setVisualPercent(float percent)
Copyright © 2021. All rights reserved.