Esempio 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);
  }
Esempio 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);
 }
 /** A default constructor */
 public ARoundRectangle() {
   this(0, 0);
   setColor(defaultColor);
 }
 /** Constructor from SmartRectangle */
 public ARoundRectangle(Color aColor) {
   this(0, 0);
   setColor(aColor);
 }