-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModes.java
More file actions
161 lines (148 loc) · 5.82 KB
/
Modes.java
File metadata and controls
161 lines (148 loc) · 5.82 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Modes {
//make a frame to hold the buttons of the modes
//make a button for each mode
//there should be not more than 3 buttons in the same y coordinates
JFrame frame = new JFrame("Modes");
JPanel panel = new JPanel();
JButton classic = new JButton("Classic");
JButton zen = new JButton("Zen");
JButton fast = new JButton("Fast");
JButton back = new JButton("Back");
JButton exit = new JButton("Exit");
JButton classicinfo = new JButton("?");
JButton zeninfo = new JButton("?");
JButton fastinfo = new JButton("?");
public Modes() {
frame.setSize(1000, 650);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocationRelativeTo(null);
frame.setResizable(false);
frame.setLayout(null);
ImageIcon logo = new ImageIcon("logo.png");
frame.setIconImage(logo.getImage());
frame.setVisible(true);
panel.setLayout(null);
panel.setBackground(Color.BLACK);
panel.setBounds(0, 0, 1000, 650);
panel.setBorder(BorderFactory.createEmptyBorder(100, 100, 100, 100));
classic.setBackground(Color.GREEN);
classic.setForeground(Color.WHITE);
classic.setFont(new Font("Comic Sans MS", Font.PLAIN, 30));
classic.setBorder(BorderFactory.createEtchedBorder());
classic.setBounds(100, 150, 200, 100);
classic.setFocusable(false);
classic.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
SnakeGameClassic.main(null);
frame.dispose();
}
});
panel.add(classic);
zen.setBackground(Color.GREEN);
zen.setForeground(Color.WHITE);
zen.setFont(new Font("Comic Sans MS", Font.PLAIN, 30));
zen.setBorder(BorderFactory.createEtchedBorder());
zen.setBounds(590, 150, 200, 100);
zen.setFocusable(false);
zen.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
SnakeGameZen.main(null);
frame.dispose();
}
});
panel.add(zen);
fast.setBackground(Color.GREEN);
fast.setForeground(Color.WHITE);
fast.setFont(new Font("Comic Sans MS", Font.PLAIN, 30));
fast.setBorder(BorderFactory.createEtchedBorder());
fast.setBounds(100, 260, 200, 100);
fast.setFocusable(false);
fast.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
SnakeGameFast.main(null);
frame.dispose();
}
});
panel.add(fast);
back.setBackground(Color.GREEN);
back.setForeground(Color.WHITE);
back.setFont(new Font("Comic Sans MS", Font.PLAIN, 30));
back.setBorder(BorderFactory.createEtchedBorder());
back.setBounds(250, 400, 200, 100);
back.setFocusable(false);
back.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
new Menu();
frame.dispose();
}
});
panel.add(back);
exit.setBackground(Color.GREEN);
exit.setForeground(Color.WHITE);
exit.setFont(new Font("Comic Sans MS", Font.PLAIN, 30));
exit.setBorder(BorderFactory.createEtchedBorder());
exit.setBounds(460, 400, 200, 100);
exit.setFocusable(false);
exit.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
frame.dispose();
}
});
panel.add(exit);
classicinfo.setBackground(Color.GREEN);
classicinfo.setForeground(Color.WHITE);
classicinfo.setFont(new Font("Comic Sans MS", Font.PLAIN, 30));
classicinfo.setBorder(BorderFactory.createEtchedBorder());
classicinfo.setBounds(310, 150, 100, 100);
classicinfo.setFocusable(false);
classicinfo.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ClassicInfoFrame.main(null);
frame.dispose();
}
});
panel.add(classicinfo);
zeninfo.setBackground(Color.GREEN);
zeninfo.setForeground(Color.WHITE);
zeninfo.setFont(new Font("Comic Sans MS", Font.PLAIN, 30));
zeninfo.setBorder(BorderFactory.createEtchedBorder());
zeninfo.setBounds(800, 150, 100, 100);
zeninfo.setFocusable(false);
zeninfo.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ZenInfoFrame.main(null);
frame.dispose();
}
});
panel.add(zeninfo);
fastinfo.setBackground(Color.GREEN);
fastinfo.setForeground(Color.WHITE);
fastinfo.setFont(new Font("Comic Sans MS", Font.PLAIN, 30));
fastinfo.setBorder(BorderFactory.createEtchedBorder());
fastinfo.setBounds(310, 260, 100, 100);
fastinfo.setFocusable(false);
fastinfo.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
FastInfoFrame.main(null);
frame.dispose();
}
});
panel.add(fastinfo);
frame.add(panel);
}
public static void main(String[] args) {
new Modes();
}
}