/** * CircularStroke.java * * @author Sunny Kim (skim@gettysburg.edu) * * represents a circular stroke with location, color, outline/filled * is used in DrawApp */ import java.awt.Color; import graphics.canvas; public class SquareStroke extends Stroke { public SquareStroke(int x, int y, int r, boolean f) { // can call any parent or your own constructor // but it has to be the first statement super(x, y, r, f); // this(x, y, r, f, canvas.randomColor()); } public SquareStroke(int x, int y, int r, boolean f, Color c) { super(x, y, r, f, c); } /** * Draws on the canvas this circular stroke */ // private parent variables may still be accessible through accessor methods public void draw() { if (filled == true) { canvas.fillSquare(cx, cy, size, getColor()); } else { canvas.drawSquare(cx, cy, size, getColor()); } } }