RotatedJokers.java


Below is the syntax highlighted version of RotatedJokers.java from §2.4 Input and Output.


/*************************************************************************
 *  Compilation:  javac RotatedJokers.java 
 *  Execution:    java RotatedJokers
 *  Dependencies: StdDraw.java joker.gif
 *
 *  Plot the image "joker.gif" at various rotations.
 *
 *************************************************************************/

import java.awt.Color;

public class RotatedJokers { 

    public static void main(String[] args) { 
        StdDraw.create(600, 450);
        StdDraw.clear(Color.gray);
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 3; j++) {
                double x = (i + 0.5) * 150;
                double y = (3 - j - 0.5) * 150; 
                double angle = 30 * (3 * i + j);
                StdDraw.go(x, y);
                StdDraw.rotate(angle);
                StdDraw.spot("joker.gif");
                StdDraw.rotate(-angle);
            }
        }
        StdDraw.show();

    }

}


Last updated: Sun Oct 24 22:26:04 EDT 2004 .
Copyright © 2004, Robert Sedgewick and Kevin Wayne.