Question 1-2

Say we execute the following method.

import csbsju.cs160.*;

public class Q1B {
  public static void run() {
    DrawableFrame w;
    w = new DrawableFrame();
    w.show();
    Graphics g = w.getGraphics();
    g.fillRect(80, 40, 40, 120);
    g.fillRect(40, 80, 120, 40);
    g.setColor(Color.white);
    g.fillRect(80, 80, 40, 40);
  }
}
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 9:40 Quiz 1