From 5fa247e24b58a01ade89bc2a1a8fb4036e7de764 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Sat, 24 Nov 2018 17:25:43 +0100 Subject: Remove Swing dependency We can build everything on top of AWT --- src/subconscious/graphics/GameWindow.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/subconscious/graphics/GameWindow.java') 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(); -- cgit v1.2.1