Component
, TextGUIElement
public class AnimatedLabel extends Label
createClassicSpinningLine()
Constructor | Description |
---|---|
AnimatedLabel(String firstFrameText) |
Creates a new animated label, initially set to one frame.
|
Modifier and Type | Method | Description |
---|---|---|
AnimatedLabel |
addFrame(String text) |
Adds one more frame at the end of the list of frames
|
protected TerminalSize |
calculatePreferredSize() |
Invokes the component renderer's size calculation logic and returns the result.
|
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!
|
AnimatedLabel |
startAnimation(long millisecondsPerFrame) |
Starts the animation thread which will periodically call
nextFrame() at the interval specified by the
millisecondsPerFrame parameter. |
AnimatedLabel |
stopAnimation() |
Halts the animation thread and the label will stop at whatever was the current frame at the time when this was
called
|
addTo, draw, getBasePane, getLayoutData, getParent, getPosition, getPreferredSize, getRenderer, getSize, getTextGUI, getTheme, getThemeDefinition, hasParent, invalidate, isInside, isInvalid, onAdded, onAfterDrawing, onBeforeDrawing, runOnGUIThreadIfExistsOtherwiseRunDirect, self, setLayoutData, setPosition, setPreferredSize, setRenderer, setSize, setTheme, toBasePane, toGlobal, withBorder
addStyle, createDefaultRenderer, getBackgroundColor, getBounds, getForegroundColor, getLabelWidth, getText, removeStyle, setBackgroundColor, setForegroundColor, setLabelWidth, setLines, setText, splitIntoMultipleLines
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 barprotected TerminalSize calculatePreferredSize()
AbstractComponent
calculatePreferredSize
in class AbstractComponent<Label>
public AnimatedLabel 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 AnimatedLabel 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 AnimatedLabel stopAnimation()
Copyright © 2020. All rights reserved.