package shapes; //FilledCircle.java //cmc, 11/23/00 import java.awt.*; /** A green colored circle. */ public class FilledCircle extends Shape5JA { private int diameter; /** Only useful constructor. @param x X coordinate @param y Y coordinate @param d diameter of circle */ public FilledCircle(int x, int y, int d) { super(x, y, d, d); diameter = d; } /** Draws the circle on the Graphics parameter. */ public void draw(Graphics g) { // Draw green filled circle g.setColor(Color.green); g.fillOval(x(), y(), diameter, diameter); // with a black outline for visibility g.setColor(Color.black); g.drawOval(x(), y(), diameter, diameter); } /** Sets diameter to value of the parameter. */ public void setDiameter(int value) { super.setWidth(value); super.setHeight(value); diameter = value; } /** Sets diameter to value of the parameter. Overrides superclass setWidth method, to reset height to same value as width. */ public void setWidth(int value) { setDiameter(value); } /** Sets diameter to value of the parameter. Overrides superclass setHeight method, to reset width to same value as height. */ public void setHeight(int value) { setDiameter(value); } }