Exemplo n.º 1
0
  /** The constructor creates all the robot parts, and sets a default location and color. */
  public AWTCar() {
    car = new ArrayList<AShape>();

    body = new ARoundRectangle();
    body.setSize(60, 40);
    car.add(body);

    window = new ARoundRectangle();
    window.setSize(20, 20);
    window.setColor(Color.WHITE);
    car.add(window);

    setLocation(0, 0);
    setColor(Color.BLUE);
  }
Exemplo n.º 2
0
 /** set the body color to the parameter and default colors for all other parts */
 public void setColor(Color c) {
   bodyColor = c;
   body.setFillColor(c);
   body.setColor(c);
 }