/** set the location of the robot to the paramters. */ public void setLocation(int x, int y) { this.x = x; this.y = y; body.setLocation(x, y); window.setLocation(x, y + 2); }
/** 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); }
/** 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); }