aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/esieequest/Game.java4
-rw-r--r--src/esieequest/GameEngine.java1
-rw-r--r--src/esieequest/UserInterface.java11
3 files changed, 15 insertions, 1 deletions
diff --git a/src/esieequest/Game.java b/src/esieequest/Game.java
index 925f067..a35cfb4 100644
--- a/src/esieequest/Game.java
+++ b/src/esieequest/Game.java
@@ -1,5 +1,7 @@
1package esieequest; 1package esieequest;
2 2
3import javax.swing.JApplet;
4
3/** 5/**
4 * The game engine. 6 * The game engine.
5 * 7 *
@@ -12,7 +14,7 @@ package esieequest;
12 * 14 *
13 * @version February 2014 15 * @version February 2014
14 */ 16 */
15public class Game { 17public class Game extends JApplet {
16 private UserInterface aGui; 18 private UserInterface aGui;
17 private GameEngine aEngine; 19 private GameEngine aEngine;
18 20
diff --git a/src/esieequest/GameEngine.java b/src/esieequest/GameEngine.java
index 3a89413..c20c70c 100644
--- a/src/esieequest/GameEngine.java
+++ b/src/esieequest/GameEngine.java
@@ -229,6 +229,7 @@ public class GameEngine {
229 private void endGame() { 229 private void endGame() {
230 this.aGui.println("Thank you for playing. Good bye."); 230 this.aGui.println("Thank you for playing. Good bye.");
231 this.aGui.enable(false); 231 this.aGui.enable(false);
232 this.aGui.killFrame();
232 } 233 }
233 234
234 /** 235 /**
diff --git a/src/esieequest/UserInterface.java b/src/esieequest/UserInterface.java
index 4f3e19e..949348e 100644
--- a/src/esieequest/UserInterface.java
+++ b/src/esieequest/UserInterface.java
@@ -112,6 +112,12 @@ public class UserInterface implements ActionListener {
112 112
113 this.aEntryField.addActionListener(this); 113 this.aEntryField.addActionListener(this);
114 114
115 this.aMyFrame.addWindowListener(new WindowAdapter() {
116 public void windowClosing(WindowEvent e) {
117 killFrame();
118 }
119 });
120
115 this.aMyFrame.pack(); 121 this.aMyFrame.pack();
116 this.aMyFrame.setVisible(true); 122 this.aMyFrame.setVisible(true);
117 this.aEntryField.requestFocus(); 123 this.aEntryField.requestFocus();
@@ -137,4 +143,9 @@ public class UserInterface implements ActionListener {
137 143
138 this.aEngine.interpretCommand(vInput); 144 this.aEngine.interpretCommand(vInput);
139 } 145 }
146
147 public void killFrame() {
148 this.aMyFrame.setVisible(false);
149 this.aMyFrame.dispose();
150 }
140} 151}