Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.
public final class Spinner
- Object
- Spinner
ImplementsAutoCloseable
An animated indicator for work of unknown length, ending in a status line:
try (Spinner s = Spinner.start("Resolving dependencies")) {
resolve();
s.succeed("Resolved 42 dependencies");
}
A spinner closed without a status clears its line. Off a terminal it prints the message once when it starts and the status when it ends.
Nested types
enum Spinner.Frames | The animation frames. |
Constructors
public Spinner(String message) | A spinner showing message, not yet started. |
Methods
public static Spinner start(String message) | Makes a spinner showing message and starts it. |
public Spinner frames(Spinner.Frames frames) | Chooses the animation; call before start. |
public Spinner start() | Starts animating. |
public void setMessage(String text) | Changes the message while spinning. |
public void println(String text) | Prints a line above the spinner. |
public void succeed(String text) | Stops with a green check and text (the message when null). |
public void fail(String text) | Stops with a red cross and text. |
public void warn(String text) | Stops with a yellow warning sign and text. |
public void info(String text) | Stops with a blue information sign and text. |
public void close() | Stops and clears the line, unless a status was already shown. |
Inherited methods
Constructor details
Spinner
public Spinner(String message)A spinner showing
message, not yet started.Method details
start
public static Spinner start(String message)Makes a spinner showing
message and starts it.frames
public Spinner frames(Spinner.Frames frames)Chooses the animation; call before
start.start
public Spinner start()Starts animating.
setMessage
public void setMessage(String text)Changes the message while spinning.
println
public void println(String text)Prints a line above the spinner.
succeed
public void succeed(String text)Stops with a green check and
text (the message when null).fail
public void fail(String text)Stops with a red cross and
text.warn
public void warn(String text)Stops with a yellow warning sign and
text.info
public void info(String text)Stops with a blue information sign and
text.close
public void close()Stops and clears the line, unless a status was already shown.