Package 

Class ConsoleLoadingAnimation

  • All Implemented Interfaces:

    
    public class ConsoleLoadingAnimation
    
                        

    A simple function to create a loading animation in the console. Useful while startup routines to show a user that the software is still working. Cant be used with ConsoleManager together.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static Array<char> animation
      private static int speed
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      static void setAnimation(Array<char> animation) The animation chars in the correct order.
      static void setSpeed(int speed) The speed of the animation.
      static void enable() Enable the loading animation and take over print stream to prevent output while loading.
      static synchronized void enable(boolean takeOverSystemOutputStream) Enable the loading animation.
      static synchronized void disable() Disable and remove the loading animation.
      static boolean isEnabled() Is the animation enabled?
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • setAnimation

         static void setAnimation(Array<char> animation)

        The animation chars in the correct order. Will also reset the animation to start at the beginning.

        Parameters:
        animation - Default is {'⣾','⣽','⣻','⢿','⡿','⣟','⣯','⣷'}.
      • setSpeed

         static void setSpeed(int speed)

        The speed of the animation. Higher is slower.

        Parameters:
        speed - Default is 25.
      • enable

         static void enable()

        Enable the loading animation and take over print stream to prevent output while loading. Cant be used with ConsoleManager together.

      • enable

         static synchronized void enable(boolean takeOverSystemOutputStream)

        Enable the loading animation. Cant be used with ConsoleManager together.

        Parameters:
        takeOverSystemOutputStream - Take over the output stream from System.out to prevent output while showing loading animation?
      • disable

         static synchronized void disable()

        Disable and remove the loading animation.

      • isEnabled

         static boolean isEnabled()

        Is the animation enabled?