From ec733e360f2c16da035778193d9a53dbf7bc3d2c Mon Sep 17 00:00:00 2001 From: Arfa Amer Butt <buttaa3@mcmaster.ca> Date: Wed, 19 Oct 2016 13:39:20 -0400 Subject: [PATCH] Update Pong_viewAndController.java to work with View --- Game_Code/src/Pong_viewAndController.java | 28 +++++++---------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/Game_Code/src/Pong_viewAndController.java b/Game_Code/src/Pong_viewAndController.java index c62997a..11002a1 100644 --- a/Game_Code/src/Pong_viewAndController.java +++ b/Game_Code/src/Pong_viewAndController.java @@ -1,15 +1,11 @@ - import java.awt.*; import javax.swing.*; - public class Pong_viewAndController extends JFrame{ - private JButton start = new JButton("Start"); private JButton suspend = new JButton("Suspend"); - private JButton tutorial = new JButton("Tutorial"); + private JButton resume = new JButton("Resume"); private JButton save = new JButton("Save"); private JButton exit = new JButton("Exit"); - - public Pong_viewAndController(){ + public Pong_viewAndController(JFrame frame){ super("FaultInOurPong"); this.setSize(700,500); this.setResizable(false); @@ -20,16 +16,12 @@ public class Pong_viewAndController extends JFrame{ JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel,BoxLayout.Y_AXIS)); - start.setMaximumSize(suspend.getPreferredSize()); - start.setAlignmentX(Component.CENTER_ALIGNMENT); - buttonPanel.add(start); - buttonPanel.add(Box.createVerticalStrut(10)); suspend.setAlignmentX(Component.CENTER_ALIGNMENT); buttonPanel.add(suspend); buttonPanel.add(Box.createVerticalStrut(10)); - tutorial.setMaximumSize(suspend.getPreferredSize()); - tutorial.setAlignmentX(Component.CENTER_ALIGNMENT); - buttonPanel.add(tutorial); + resume.setMaximumSize(suspend.getPreferredSize()); + resume.setAlignmentX(Component.CENTER_ALIGNMENT); + buttonPanel.add(resume); buttonPanel.add(Box.createVerticalStrut(10)); save.setMaximumSize(suspend.getPreferredSize()); save.setAlignmentX(Component.CENTER_ALIGNMENT); @@ -39,14 +31,10 @@ public class Pong_viewAndController extends JFrame{ exit.setAlignmentX(Component.CENTER_ALIGNMENT); buttonPanel.add(exit); - //JPanel west = new JPanel(new GridBagLayout()); - // west.add(buttonPanel); - Game game = new Game(); game_interface.add(buttonPanel); game_interface.add(game); - //add(west,BorderLayout.WEST); add(game_interface); setLocationRelativeTo(null); @@ -54,8 +42,8 @@ public class Pong_viewAndController extends JFrame{ this.setVisible(true); } - public static void main(String[] args){ + /*public static void main(String[] args){ Pong_viewAndController view_controller = new Pong_viewAndController(); - } + }*/ -} +} \ No newline at end of file -- GitLab