Class Spinner

java.lang.Object
com.codename1.cli.Spinner
All Implemented Interfaces:
AutoCloseable

public final class Spinner extends Object implements AutoCloseable

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.

  • 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(String).
    • 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.
      Specified by:
      close in interface AutoCloseable