PennDraw.java
/**
     * Display on screen, pause for t milliseconds, and turn on
     * <em>animation mode</em>: subsequent calls to
     * drawing methods such as <tt>line()</tt>, <tt>circle()</tt>, and <tt>square()</tt>
     * will not be displayed on screen until the next call to <tt>show()</tt>.
     * This is useful for producing animations (clear the screen, draw a bunch of shapes,
     * display on screen for a fixed amount of time, and repeat). It also speeds up
     * drawing a huge number of shapes (call <tt>show(0)</tt> to defer drawing
     * on screen, draw the shapes, and call <tt>show(0)</tt> to display them all
     * on screen at once).
     * @param t number of milliseconds
     */
Display on screen, pause for t milliseconds, and turn on
animation mode: subsequent calls to
drawing methods such as line(), circle(), and square()
will not be displayed on screen until the next call to show().
This is useful for producing animations (clear the screen, draw a bunch of shapes,
display on screen for a fixed amount of time, and repeat). It also speeds up
drawing a huge number of shapes (call show(0) to defer drawing
on screen, draw the shapes, and call show(0) to display them all
on screen at once).
@param t number of milliseconds
Display on screen pause for t milliseconds and turn on animation mode : subsequent calls to drawing methods such as line () circle () and square () will not be displayed on screen until the next call to show () . This is useful for producing animations ( clear the screen draw a bunch of shapes display on screen for a fixed amount of time and repeat ) . It also speeds up drawing a huge number of shapes ( call show ( 0 ) to defer drawing on screen draw the shapes and call show ( 0 ) to display them all on screen at once ) . @param t number of milliseconds
public static void show(int t) {
        long millis = System.currentTimeMillis();
        if (millis < nextDraw) {
            try { Thread.sleep(nextDraw - millis); }
            catch (InterruptedException e) { System.out.println("Error sleeping"); }
            millis = nextDraw;
        }
        defer = false;
        draw();
        defer = true;
        nextDraw = millis + t;
    }
public static void show ( int t ) { long millis = System . currentTimeMillis ( ) ; if ( millis < nextDraw ) { try { Thread . sleep ( nextDraw - millis ) ; } catch ( InterruptedException e ) { System . out . println ( "Error sleeping" ) ; } millis = nextDraw ; } defer = false ; draw ( ) ; defer = true ; nextDraw = millis + t ; }
Display on screen, pause for t milliseconds, and turn on
 <em>animation mode</em>: subsequent calls to
 drawing methods such as <tt>line()</tt>, <tt>circle()</tt>, and <tt>square()</tt>
 will not be displayed on screen until the next call to <tt>show()</tt>.
Display on screen pause for t milliseconds and turn on <em > animation mode< / em > : subsequent calls to drawing methods such as <tt > line () < / tt > <tt > circle () < / tt > and <tt > square () < / tt > will not be displayed on screen until the next call to <tt > show () < / tt > .
// sleep until the next time we're allowed to draw