Question 1-2

Say we execute the following method.

import csbsju.cs160.*;

public class Q1A {
  public static void run() {
    DrawableFrame w;
    w = new DrawableFrame();
    w.show();
    Graphics g = w.getGraphics();
    g.fillRect(50, 50, 100, 100);
    g.setColor(Color.white);
    g.fillRect(75, 0, 50, 200);
    g.fillRect(0, 75, 200, 50);
  }
}
The fillRect() method draws a filled rectangle. It takes four integer parameters: the left side's x-coordinate, the top side's y-coordinate, the width, and the height.

Complete the below window as it will appear on the screen.

Solution

Back to 8:00 Quiz 1