public class Screen {
  private final int width;
  private final int height;
  private final CanvasArea area;
  private final Component root;

  public Screen(String title, int width, int height, Component root) {
    this.width = width;
    this.height = height;
    this.area = new CanvasArea(Objects.requireNonNull(title), width, height);
    this.root = Objects.requireNonNull(root);
  }

  public void paintAll() {
    root.paint(area, new Rect(0, 0, width, height));
  }

  public static void main(String[] args) throws IOException {
    Component root = new ColoredFiller(Brush.BLUE);
    // Component root = new Icon(Image.createImage(Paths.get("td4/composite.png")))

    Screen screen = new Screen("-- screen --", 900, 600, root);
    screen.paintAll();
  }
}