import java.awt.Panel; public class BoundedBall extends Ball { private Panel myWorld; public BoundedBall( int x, int y, int r, double dx, double dy, Panel f ) { super( x, y, r, dx, dy ); myWorld = f; } public void move() { super.move(); int maxWidth = myWorld.getWidth(); if (( x() < 0 ) || ( x() > maxWidth )) reverseDeltaX(); int maxHeight = myWorld.getHeight(); if (( y() < 0 ) || ( y() > maxHeight )) reverseDeltaY(); } }