/** * CS161 Lab 5. * This Lab will take the settings from Lab 2 and draw the robot automatically via * previously save settings. * Author- John Sloan * Date-02/05/08 */ public class picture { private Square head; private Square body; private Rect neck; private Rect leftArm; private Rect rightArm; private Triangle leftLeg; private Triangle rightLeg; private Circle leftWheel; private Circle rightWheel; /** * Constructor for objects of class picture drawing objects from * classes in Shapes 2 project. */ public picture() { head = new Square (); body = new Square (); neck = new Rect (); leftArm = new Rect (); rightArm = new Rect (); leftLeg = new Triangle (); rightLeg = new Triangle (); leftWheel = new Circle (); rightWheel = new Circle (); } /** * The mutator method draws the head of the robot. */ public void drawHead() { head.makeVisible (); head.changeSize (50); head.slowMoveHorizontal (93); head.slowMoveVertical (50); } /** * The mutator method draws the body of the robot. */ public void drawBody() { body.makeVisible (); body.changeSize (80); body.slowMoveHorizontal (80); body.slowMoveVertical (125); } /** * The mutator method draws and moves the neck of the robot. */ public void drawNeck() { neck.makeVisible (); neck.changeSize (15,25); neck.slowMoveHorizontal (114); neck.slowMoveVertical (100); } /** * The mutator method draws and moves the left arm of the robot. */ public void drawLeftArm() { leftArm.makeVisible (); leftArm.changeSize (25,15); leftArm.slowMoveHorizontal (55); leftArm.slowMoveVertical (140); } /** * The mutator method draws and moves the right arm of the robot. */ public void drawRightArm() { rightArm.makeVisible (); rightArm.changeSize (25,15); rightArm.slowMoveHorizontal (160); rightArm.slowMoveVertical (140); } /** * The mutator method draws and moves the left leg of the robot. */ public void drawLeftLeg() { leftLeg.makeVisible (); leftLeg.changeSize (25,15); leftLeg.slowMoveHorizontal (100); leftLeg.slowMoveVertical (240); } /** * The mutator method draws and moves the right leg of the robot. */ public void drawRightLeg() { rightLeg.makeVisible (); rightLeg.changeSize (25,15); rightLeg.slowMoveHorizontal (160); rightLeg.slowMoveVertical (240); } /** * The mutator method draws and moves the left wheel of the robot. */ public void drawLeftWheel() { leftWheel.makeVisible (); leftWheel.changeSize (30); leftWheel.slowMoveHorizontal (116); leftWheel.slowMoveVertical (215); } /** * The mutator method draws and moves the right wheel of the robot. */ public void drawRightWheel() { rightWheel.makeVisible (); rightWheel.changeSize (30); rightWheel.slowMoveHorizontal (176); rightWheel.slowMoveVertical (215); } /** * This method draws the entire project. */ public void makePicture() { //these are the methods to draw drawHead (); drawBody (); drawNeck (); drawLeftArm (); drawRightArm (); drawLeftLeg (); drawRightLeg (); drawLeftWheel (); drawRightWheel (); } }