// // FILE: BallWorldFrame.java // AUTHOR: Timothy Budd // DATE: unknown // COMMENT: simple window to demonstrate Java graphics // // MODIFIED: 2012/09/18 by Eugene Wallingford // CHANGE: adapted for CS 2530 // import java.awt.Frame; import java.awt.Graphics; public class BallWorldFrame extends Frame { private static final int FrameWidth = 600; private static final int FrameHeight = 400; private static final int Iterations = 20; private Ball ball; private int counter; public BallWorldFrame() { super(); setSize ( FrameWidth, FrameHeight ); setTitle( "Ball World" ); ball = new Ball( 100, 100, 10, 10, 5 ); counter = 0; } public void paint( Graphics g ) { ball.paint( g ); ball.move(); counter++; if ( counter >= Iterations ) return; // instead of return, try: System.exit( 0 ); repaint(); } }