// ----------------------------------- // A simple pause method for animation // Fritz Ruehr * CS 231 * Fall 2004 // ----------------------------------- public class Pause { // This method can be called as "Pause.pause(n)" from the outside (your code), where // n is the number of milliseconds you wish to pause (1000 milliseconds = 1 second). // The actual pause you get may be slightly longer. public static void pause(int millis) { int start = (int) System.currentTimeMillis(); while(((int)System.currentTimeMillis()) < start + millis) { // empty loop body! } } // end pause method // ---------------------------------- // This is a simple test harness, as main method, to show that pause works public static void main (String[] args){ System.out.println("Start"); pause (3000); System.out.println("Stop"); } // end main method } // end Pause class