Question 1-3

Draw a picture of the window drawn by the following method.

import csbsju.cs160.*;

public class GraphicsExample {
    public static void run() {
        DrawableFrame window = new DrawableFrame();
        window.show();

        Graphics g = window.getGraphics();
        g.fillOval(50, 50, 100, 100);
        g.setColor(Color.white);
        g.fillRect(0, 0, 100, 200);
        g.fillOval(75, 50, 50, 50);
        g.setColor(Color.black);
        g.fillOval(75, 100, 50, 50);
        g.drawOval(50, 50, 100, 100);
    }
}

Solution

Back to Review for Quiz 1