SYSC 2004 Lecture 3: Square
Document Summary
* a square that can be manipulated and that draws itself on a canvas. * @author michael k lling and david j. barnes. * @version 2016. 02. 29 public class square private int size; private int xposition; private int yposition; private string color; private boolean isvisible; * create a new square at default position with default color. public square() size = 60; xposition = 310; yposition = 120; color = red; isvisible = false; If it was already visible, do nothing. public void makevisible() isvisible = true; draw(); If it was already invisible, do nothing. public void makeinvisible() erase(); isvisible = false; * move the square a few pixels to the right. public void moveright() movehorizontal(20); * move the square a few pixels to the left. public void moveleft() movehorizontal(-20); * move the square a few pixels up. public void moveup() movevertical(-20); * move the square a few pixels down. public void movedown() movevertical(20);