/** * CircleSprite.java * @author Jeff Ondich, 5 November 2010 * * The abstract parent class for Sprites in the Playground example. */ import java.awt.*; public class CircleSprite extends Sprite { private Color circleColor; private int radius; public CircleSprite(int x, int y, int vx, int vy, Color color) { super(x, y, vx, vy); this.circleColor = color; this.radius = 40; } /** * Required implementation of Sprite's abstract draw method. */ public void draw(Graphics g) { Color previousColor = g.getColor(); g.setColor(this.circleColor); g.fillOval(this.positionX, this.positionY, this.radius * 2, this.radius * 2); g.setColor(Color.BLACK); g.drawOval(this.positionX, this.positionY, this.radius * 2, this.radius * 2); g.setColor(previousColor); } }