Skip to content
Snippets Groups Projects
Commit ec733e36 authored by Arfa Butt's avatar Arfa Butt
Browse files

Update Pong_viewAndController.java to work with View

parent 146ebd7b
No related branches found
No related tags found
No related merge requests found
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment