-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenuPage.java
More file actions
54 lines (44 loc) · 1.48 KB
/
MenuPage.java
File metadata and controls
54 lines (44 loc) · 1.48 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
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class MenuPage extends JFrame implements ActionListener{
private Container pane;
private JButton newGame;
private JButton oldGame;
private JButton settings;
//CONSTRUCTOR SETS EVERYTHING UP
public MenuPage() {
this.setTitle("soDoCa");
this.setSize(500,500);
this.setLocation(100,100);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
pane = this.getContentPane();
pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS)); //NOTE!! THIS CAN BE CHANGED (see below)
newGame = new JButton("Play a New Game");
newGame.setMaximumSize(new Dimension(Integer.MAX_VALUE, newGame.getMinimumSize().height));
oldGame = new JButton("Play an Old Game");
oldGame.setMaximumSize(new Dimension(Integer.MAX_VALUE, oldGame.getMinimumSize().height));
settings = new JButton("Settings");
settings.setMaximumSize(new Dimension(Integer.MAX_VALUE, settings.getMinimumSize().height));
pane.add(newGame);
pane.add(oldGame);
pane.add(settings);
}
public void actionPerformed(ActionEvent e){
String event = e.getActionCommand();
if (event.equals("new")){
//link to new puzzle?
}
if (event.equals("old")){
//link to new puzzle?
}
if (event.equals("settings")){
//link to settings?
}
}
//MAIN JUST INSTANTIATES + MAKE VISIBLE
public static void main(String[] args) {
MenuPage g = new MenuPage();
g.setVisible(true);
}
}