From 146ebd7ba0e6043bc2152fc26e21dd3c6e1d58e6 Mon Sep 17 00:00:00 2001
From: Arfa Amer Butt <buttaa3@mcmaster.ca>
Date: Wed, 19 Oct 2016 13:34:33 -0400
Subject: [PATCH] View file added

---
 Game_Code/src/View.java | 80 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)
 create mode 100644 Game_Code/src/View.java

diff --git a/Game_Code/src/View.java b/Game_Code/src/View.java
new file mode 100644
index 0000000..22fc644
--- /dev/null
+++ b/Game_Code/src/View.java
@@ -0,0 +1,80 @@
+
+import java.awt.BorderLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+
+public class View extends JFrame{
+
+	private JButton start = new JButton("Start New Game");
+	private JButton load = new JButton("Load Game");
+	private JButton highScores = new JButton("High Scores");
+	private JButton tutorial = new JButton("Tutorial");
+	private JButton exit = new JButton("Exit");
+	
+	public View(){
+		super("FaultInOurPong");
+		this.setSize(700,500);
+		this.setResizable(false);
+		
+		JPanel buttonPanel = new JPanel();
+		buttonPanel.setLayout(new BoxLayout(buttonPanel,BoxLayout.Y_AXIS));
+		
+		load.setMaximumSize(start.getPreferredSize());
+		highScores.setMaximumSize(start.getPreferredSize());
+		tutorial.setMaximumSize(start.getPreferredSize());
+		exit.setMaximumSize(start.getPreferredSize());
+		
+		start.setAlignmentY(CENTER_ALIGNMENT);
+		start.setAlignmentX(CENTER_ALIGNMENT);
+		load.setAlignmentY(CENTER_ALIGNMENT);
+		load.setAlignmentX(CENTER_ALIGNMENT);
+		highScores.setAlignmentY(CENTER_ALIGNMENT);
+		highScores.setAlignmentX(CENTER_ALIGNMENT);
+		tutorial.setAlignmentY(CENTER_ALIGNMENT);
+		tutorial.setAlignmentX(CENTER_ALIGNMENT);
+		exit.setAlignmentY(CENTER_ALIGNMENT);
+		exit.setAlignmentX(CENTER_ALIGNMENT);
+		
+		start.addActionListener(new ActionListener() {
+			public void actionPerformed(ActionEvent e) {
+				start();
+			}
+		});
+		
+		buttonPanel.add(Box.createVerticalGlue());
+		buttonPanel.add(start);
+		buttonPanel.add(Box.createVerticalStrut(20));
+		buttonPanel.add(load);
+		buttonPanel.add(Box.createVerticalStrut(20));
+		buttonPanel.add(highScores);
+		buttonPanel.add(Box.createVerticalStrut(20));
+		buttonPanel.add(tutorial);
+		buttonPanel.add(Box.createVerticalStrut(20));
+		buttonPanel.add(exit);
+		buttonPanel.add(Box.createVerticalGlue());
+		
+		add(buttonPanel);
+		
+		this.setDefaultCloseOperation(EXIT_ON_CLOSE);
+		this.setLocationRelativeTo(null);
+		this.setVisible(true);
+	}
+	
+	public void start() {
+		//getContentPane().removeAll();
+		//repaint();
+		Pong_viewAndController view_controller = new Pong_viewAndController(this);
+		this.setVisible(false);
+	}
+	
+	public static void main(String[] args) {
+		View menuPage = new View();
+	}
+
+}
-- 
GitLab