Here you can find the source of printLoadToConsole(int milliOffset)
Parameter | Description |
---|---|
milliOffset | a parameter |
public static void printLoadToConsole(int milliOffset)
//package com.java2s; //License from project: Open Source License import java.util.Timer; import java.util.TimerTask; public class Main { private static boolean loading = false; /**/*from w w w . j av a 2 s . c o m*/ * Prints a spinning icon to the console * @param milliOffset */ public static void printLoadToConsole(int milliOffset) { loading = true; final Timer t = new Timer(); TimerTask task = new TimerTask() { int loop = 0; public void run() { if (loading) { loop++; if (loop == 1) { System.out.print("\b|"); } if (loop == 2) { System.out.print("\b/"); } if (loop == 3) { System.out.print("\b-"); } if (loop == 4) { System.out.print("\b\\"); loop = 0; } } else { System.out.print("\b"); t.cancel(); } } }; t.schedule(task, 00, milliOffset); } }