/** * Circle is a "wrapper" around Ellipse2D that makes it easier * to draw circles * * @author P. Conrad * @version CS10, UCSB, Spring 2009, 04/29 */ public class Circle extends java.awt.geom.Ellipse2D.Double { /** * Constructor for objects of class Circle * @param x x coordinate of center of circle * @param y y coordinate of center of circle * @param r radius of circle */ public Circle(double x, double y, double r) { // invoke the super class constructor, // i.e. the one for Ellipse2D.Double, which takes // upper-left-x, upper-left-y (of the bounding box) // width, and height super( x - r, y - r, /* upper left corner of bounding box */ r * 2, r * 2); /* width and height are double the radius */ } }