import java.awt.BorderLayout; import javax.swing.JFrame; /* * Represents the main window as well as methods to control the game. Acts as * 'switch' to pass requests from one item along to another. */ public class InvadersWindow extends JFrame { // This window "has" an arena (where the game action happens) and a controller // (containing the elements that control the program) Arena arena = null; Controller controller = null; // Constructor method (no return type, same name as class). Called automatically // when a new instance is created. Usually responsible for layout and setting up public InvadersWindow() { arena = new Arena(); controller = new Controller(this); setLayout(new BorderLayout()); add("Center", arena); add("South", controller); } // Calls on the arena's start method to start a game public void start() { arena.start(); } public void fire() { arena.fire(); } }