package dk.itu.oop.ballgame; import javax.swing.JFrame; import java.awt.event.*; class BallGame extends JFrame { private MovingBall b1; public BallGame() { b1 = new MovingBall("Red", this); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(400, 400); setTitle("BallGame"); setVisible(true); } public void step(){ if (b1 == null) return; b1.move(); b1.draw(); } public static void main(String args[]) { System.out.println("BallGame"); final BallGame mainFrame = new BallGame(); while ( true ){ try{Thread.sleep(10);}catch(InterruptedException e){}; mainFrame.step(); } } }