diff options
-rw-r--r-- | src/subconscious/graphics/GameWindow.java | 14 | ||||
-rw-r--r-- | src/subconscious/graphics/MenuScene.java | 10 | ||||
-rw-r--r-- | src/subconscious/graphics/Scene.java | 6 |
3 files changed, 12 insertions, 18 deletions
diff --git a/src/subconscious/graphics/GameWindow.java b/src/subconscious/graphics/GameWindow.java index 65af798..f444a6a 100644 --- a/src/subconscious/graphics/GameWindow.java +++ b/src/subconscious/graphics/GameWindow.java @@ -8,10 +8,8 @@ import java.util.AbstractMap.SimpleEntry; import java.awt.Dimension; import java.awt.CardLayout; import java.awt.BorderLayout; - -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.JButton; +import java.awt.Frame; +import java.awt.Panel; import java.awt.event.WindowListener; import java.awt.event.WindowEvent; @@ -21,10 +19,10 @@ import java.awt.event.WindowEvent; * unloading scenes, and the window itself */ @SuppressWarnings("serial") -public class GameWindow extends JFrame implements WindowListener { +public class GameWindow extends Frame implements WindowListener { public static final Dimension WINDOW_SIZE = new Dimension(600, 400); - private JPanel root; + private Panel root; // reference to the current scene which is NOT on the stack private Scene scene = null; @@ -41,7 +39,7 @@ public class GameWindow extends JFrame implements WindowListener { this.game = g; // set up JFrame - this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + // this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setSize(WINDOW_SIZE); this.setPreferredSize(WINDOW_SIZE); this.setLocationRelativeTo(null); @@ -50,7 +48,7 @@ public class GameWindow extends JFrame implements WindowListener { // set up components // set up a cardlayout - this.root = new JPanel(new CardLayout()); + this.root = new Panel(new CardLayout()); this.add(this.root, BorderLayout.CENTER); this.pack(); diff --git a/src/subconscious/graphics/MenuScene.java b/src/subconscious/graphics/MenuScene.java index 1a7e7f2..32d9569 100644 --- a/src/subconscious/graphics/MenuScene.java +++ b/src/subconscious/graphics/MenuScene.java @@ -6,13 +6,11 @@ import java.awt.Graphics2D; import java.awt.GridLayout; import java.awt.BorderLayout; import java.awt.Dimension; +import java.awt.Button; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.JButton; @SuppressWarnings("serial") @@ -30,15 +28,15 @@ public class MenuScene extends Scene implements ActionListener { // build Menu card this.setLayout(new GridLayout(3, 1)); - JButton editor = new JButton("Editor"); + Button editor = new Button("Editor"); editor.setActionCommand("btn-editor"); editor.addActionListener(this); - JButton battle = new JButton("Battle"); + Button battle = new Button("Battle"); battle.setActionCommand("btn-battle"); battle.addActionListener(this); - JButton exit = new JButton("Exit"); + Button exit = new Button("Exit"); exit.setActionCommand("btn-exit"); exit.addActionListener(this); diff --git a/src/subconscious/graphics/Scene.java b/src/subconscious/graphics/Scene.java index a6ac018..5188ab4 100644 --- a/src/subconscious/graphics/Scene.java +++ b/src/subconscious/graphics/Scene.java @@ -11,6 +11,7 @@ import java.awt.Canvas; import java.awt.Graphics2D; import java.awt.Dimension; import java.awt.BorderLayout; +import java.awt.Panel; import java.awt.event.KeyListener; import java.awt.event.KeyEvent; @@ -24,9 +25,6 @@ import java.awt.event.ComponentEvent; import java.awt.image.BufferStrategy; -import javax.swing.JFrame; -import javax.swing.JPanel; - /* Scene * Abstract model class for all scenes of the game. Each scene is in a different @@ -37,7 +35,7 @@ import javax.swing.JPanel; * object which controls the internal state of the game. */ @SuppressWarnings("serial") -public abstract class Scene extends JPanel +public abstract class Scene extends Panel implements Runnable, KeyListener, MouseListener, MouseMotionListener, MouseWheelListener, ComponentListener { |