-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenu.java
More file actions
97 lines (76 loc) · 2.64 KB
/
Menu.java
File metadata and controls
97 lines (76 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.Insets;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Dimension;
import javax.swing.JSpinner;
public class Menu extends JFrame implements ActionListener {
private static final String ORIG = "TIC TAC TOE";
private static final String OBST = "Obstruction";
private JButton original;
private JButton obstruct;
private JButton load;
private JButton exit;
private GridBagConstraints cont;
//private GridBagLayout layCont;
public Menu() {
menuLayout();
pack();
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
private void menuLayout() {
setTitle("TIC TAC TOE Collection");
setPreferredSize(new Dimension(900, 900));
setLocation(500,100);
setLayout(new GridBagLayout());
original = new JButton(ORIG);
original.setPreferredSize(new Dimension(120, 45));
original.addActionListener(this);
cont = new GridBagConstraints();
cont.insets = new Insets(50, 70, 0, 70);
add(original, cont);
obstruct = new JButton(OBST);
obstruct.setPreferredSize(new Dimension(120, 45));
obstruct.addActionListener(this);
cont = new GridBagConstraints();
cont.insets = new Insets(50, 70, 0, 70);
cont.gridy = 50;
add(obstruct, cont);
load = new JButton("Load Game");
load.setPreferredSize(new Dimension(120, 45));
load.addActionListener(this);
cont = new GridBagConstraints();
cont.insets = new Insets(50, 70, 0, 70);
cont.gridy = 100;
add(load, cont);
exit = new JButton("Exit Game");
exit.setPreferredSize(new Dimension(120, 45));
exit.addActionListener(this);
cont = new GridBagConstraints();
cont.insets = new Insets(50, 70, 50, 70);
cont.gridy = 150;
add(exit, cont);
}
private void boardSetup () { // asks for the size of the board OBSTRUCTION
}
@Override
public void actionPerformed(ActionEvent event) {
if (event.getSource().equals(original)) {
TICTACTOE game = new TICTACTOE();
}
else if (event.getSource().equals(obstruct)) {
}
else if (event.getSource().equals(load)) {
}
else if (event.getSource().equals(exit)) {
dispose();
}
}
public static void main(String[] args) {
Menu game = new Menu();
}
}