public class ProgressBar extends Widget implements Disableable
ChangeListener.ChangeEvent
is fired when the progress bar knob is moved. Cancelling the event will move the knob to where it was
previously.
The preferred height of a progress bar is determined by the larger of the knob and background. The preferred width of progress bar is 140, a relatively arbitrary size.
Modifier and Type | Class and Description |
---|---|
static class |
ProgressBar.ProgressBarStyle
The style for a progress bar, see
ProgressBar . |
Constructor and Description |
---|
ProgressBar(float min,
float max,
float stepSize,
boolean vertical,
ProgressBar.ProgressBarStyle style)
Creates a new progress bar.
|
ProgressBar(float min,
float max,
float stepSize,
boolean vertical,
Skin skin) |
ProgressBar(float min,
float max,
float stepSize,
boolean vertical,
Skin skin,
String styleName) |
Modifier and Type | Method and Description |
---|---|
void |
act(float delta)
Updates the actor based on time.
|
void |
draw(Batch batch,
float parentAlpha)
If this method is overridden, the super method or
Widget.validate() should be called to ensure the widget is laid out. |
float |
getMaxValue() |
float |
getMinValue() |
float |
getPercent() |
float |
getPrefHeight() |
float |
getPrefWidth() |
float |
getStepSize() |
ProgressBar.ProgressBarStyle |
getStyle()
Returns the progress bar's style.
|
float |
getValue() |
float |
getVisualPercent() |
float |
getVisualValue()
If
animating the progress bar value, this returns the value current displayed. |
boolean |
isDisabled() |
void |
setAnimateDuration(float duration)
If > 0, changes to the progress bar value via
setValue(float) will happen over this duration in seconds. |
void |
setAnimateInterpolation(Interpolation animateInterpolation)
Sets the interpolation to use for
setAnimateDuration(float) . |
void |
setDisabled(boolean disabled) |
void |
setRange(float min,
float max)
Sets the range of this progress bar.
|
void |
setStepSize(float stepSize) |
void |
setStyle(ProgressBar.ProgressBarStyle style) |
boolean |
setValue(float value)
Sets the progress bar position, rounded to the nearest step size and clamped to the minimum and maximum values.
|
void |
setVisualInterpolation(Interpolation interpolation)
Sets the interpolation to use for display.
|
getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, invalidate, invalidateHierarchy, layout, needsLayout, pack, setFillParent, setLayoutEnabled, validate
addAction, addCaptureListener, addListener, clear, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, debug, drawDebug, fire, 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, hasParent, hit, isAscendantOf, isDescendantOf, isTouchable, isVisible, localToAscendantCoordinates, localToParentCoordinates, 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, setY, setZIndex, sizeBy, sizeBy, stageToLocalCoordinates, toBack, toFront, toString
public ProgressBar(float min, float max, float stepSize, boolean vertical, Skin skin)
public ProgressBar(float min, float max, float stepSize, boolean vertical, Skin skin, String styleName)
public ProgressBar(float min, float max, float stepSize, boolean vertical, ProgressBar.ProgressBarStyle style)
NinePatch
or progress bar handle TextureRegion
. The min and
max values determine the range the values of this progress bar 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 ProgressBar.ProgressBarStyle
public void setStyle(ProgressBar.ProgressBarStyle style)
public ProgressBar.ProgressBarStyle getStyle()
setStyle(ProgressBarStyle)
is called.public void act(float delta)
Actor
Stage.act(float)
.
The default implementation calls Action.act(float)
on each action and removes actions that are complete.
public void draw(Batch batch, float parentAlpha)
Widget
Widget.validate()
should be called to ensure the widget is laid out.public float getValue()
public float getVisualValue()
animating
the progress bar value, this returns the value current displayed.public float getPercent()
public float getVisualPercent()
public boolean setValue(float value)
clamp(float)
can be overridden to allow values outside of the progress bar's min/max range.public void setRange(float min, float max)
public void setStepSize(float stepSize)
public float getPrefWidth()
getPrefWidth
in interface Layout
getPrefWidth
in class Widget
public float getPrefHeight()
getPrefHeight
in interface Layout
getPrefHeight
in class Widget
public float getMinValue()
public float getMaxValue()
public float getStepSize()
public void setAnimateDuration(float duration)
setValue(float)
will happen over this duration in seconds.public void setAnimateInterpolation(Interpolation animateInterpolation)
setAnimateDuration(float)
.public void setVisualInterpolation(Interpolation interpolation)
public void setDisabled(boolean disabled)
setDisabled
in interface Disableable
public boolean isDisabled()
isDisabled
in interface Disableable
Copyright © 2016. All rights reserved.