import java.awt.*; public class Peg extends ScorePad { private int state = 1; public Peg (int x, int y, int v) { super(x, y, v); } public void paint (Graphics g) { super.paint(g); int r = (int) radius(); int x = (int) x(); int y = (int) y(); if (state == 2) { g.drawOval(x -(r+3), y -(r+3), 2*(r+3), 2*(r+3)); state = 1; } else g.drawOval(x-(r+2), y-(r+2), 2*(r+2), 2*(r+2)); } public void hitBy (PinBall aBall) { super.hitBy(aBall); //update the score aBall.reflectVert(); aBall.reflectHorz(); while (intersects(aBall))//move out of range aBall.move(); state = 2; //next draw will expand circle } }