import java.awt.*;

public class BouncingObject extends BouncingBall2 {

	protected ObjectDisplay theObjectDisplay;
	protected ObjectDisplayFactory objectFactory;

	protected void initAnimator() {
		String att = getParameter("displayobject");
		System.out.println(att);
		objectFactory = new StaticObjectDisplayFactory();
		theObjectDisplay = objectFactory.makeObjectDisplay(att);
		super.initAnimator();
    }

    protected void paintFrame(Graphics g){

		g.setColor(Color.white);
		g.fillRect(0,0,d.width,d.height);
		if (x < radius || x > d.width - radius) {
		  dx = -dx;
		}

		if (y < radius || y > d.height - radius) {
		  dy  =  -dy;
		}
		x += dx; y += dy;
		g.setColor(color);
		theObjectDisplay.display(x, y, g);
    }
}