public class AnimatedLabel extends Label
createClassicSpinningLine()
Constructor and Description |
---|
AnimatedLabel(String firstFrameText)
Creates a new animated label, initially set to one frame.
|
Modifier and Type | Method and Description |
---|---|
void |
addFrame(String text)
Adds one more frame at the end of the list of frames
|
static AnimatedLabel |
createClassicSpinningLine()
Creates a classic spinning bar which can be used to signal to the user that an operation in is process.
|
static AnimatedLabel |
createClassicSpinningLine(int speed)
Creates a classic spinning bar which can be used to signal to the user that an operation in is process.
|
void |
nextFrame()
Advances the animated label to the next frame.
|
void |
onRemoved(Container container)
Called by the GUI system when you remove a component from a container; DO NOT CALL THIS YOURSELF!
|
void |
startAnimation(long millisecondsPerFrame)
Starts the animation thread which will periodically call
nextFrame() at the interval specified by the
millisecondsPerFrame parameter. |
void |
stopAnimation()
Halts the animation thread and the label will stop at whatever was the current frame at the time when this was
called
|
addStyle, createDefaultRenderer, getBackgroundColor, getBounds, getForegroundColor, getLabelWidth, getText, removeStyle, setBackgroundColor, setForegroundColor, setLabelWidth, setLines, setText, splitIntoMultipleLines
addTo, calculatePreferredSize, draw, getBasePane, getLayoutData, getParent, getPosition, getPreferredSize, getRenderer, getRendererFromTheme, getSize, getTextGUI, hasParent, invalidate, isInside, isInvalid, onAdded, onAfterDrawing, onBeforeDrawing, runOnGUIThreadIfExistsOtherwiseRunDirect, self, setLayoutData, setPosition, setPreferredSize, setRenderer, setSize, toBasePane, toGlobal, withBorder
public AnimatedLabel(String firstFrameText)
startAnimation()
for this to start moving.firstFrameText
- The content of the label at the first framepublic static AnimatedLabel createClassicSpinningLine()
AnimatedLabel
instance which is setup to show a spinning barpublic static AnimatedLabel createClassicSpinningLine(int speed)
speed
- Delay in between each frameAnimatedLabel
instance which is setup to show a spinning barpublic void addFrame(String text)
text
- Text to use for the label at this framepublic void nextFrame()
public void onRemoved(Container container)
Component
onRemoved
in interface Component
onRemoved
in class AbstractComponent<Label>
container
- Container that this component was just removed frompublic void startAnimation(long millisecondsPerFrame)
nextFrame()
at the interval specified by the
millisecondsPerFrame
parameter. After all frames have been cycled through, it will start over from the
first frame again.millisecondsPerFrame
- The interval in between every framepublic void stopAnimation()
Copyright © 2016. All rights reserved.