- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStartPage.java
More file actions
Latest commit
198 lines (163 loc) · 5.86 KB
/
Copy pathStartPage.java
File metadata and controls
198 lines (163 loc) · 5.86 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
importjava.lang.*;
importjava.awt.*;
importjavax.swing.*;
importjava.awt.event.*;
importjava.util.*;
publicclassStartPageextendsJFrameimplementsMouseListener, ActionListener
{
privateJPanelpanelMain;
privateJButtonbtnStart,btnExit,btnHelp;
privateJRadioButtonl1,l2,l3;
privateJLabellabelMain,labelSlevel,labelHS,lavelEasy,labelMid,labelHard;
privateFontfont1 = newFont("Consolas", Font.BOLD | Font.ITALIC, 35);
privateFontfont2 = newFont("Consolas", Font.BOLD | Font.ITALIC, 20);
privateColorcolorBG = newColor(36, 64, 109);
privateColorbg = newColor(155, 242, 157);
MainPageMP;
intGameLavel;
intHSEasy,HSMid,HSHard;
intlevel,score;
String[] Value;
StartPage()
{
super("Puzzle Game");
this.setSize(1000,800);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
panelMain = newJPanel();
panelMain.setBackground(colorBG);
panelMain.setLayout(null);
////////////////////////////////////// MAIN ////////////////////////////////////
labelMain = newJLabel();
labelMain.setFont(font1);
labelMain.setForeground(Color.WHITE);
labelMain.setBounds(350,50,500,80);
labelMain.setText("MATCH THE NUMBERS");
panelMain.setLayout(null);
panelMain.add(labelMain);
btnStart = newJButton("START");
btnStart.setBounds(450,160,100,40);
btnStart.setBackground(bg);
btnStart.addMouseListener(this);
btnStart.addActionListener(this);
panelMain.add(btnStart);
////////////////////////////////////// LEVEL SELECT ////////////////////////////
labelSlevel = newJLabel();
labelSlevel.setText("SELECT LEVEL");
labelSlevel.setBounds(450,230,160,40);
labelSlevel.setFont(font2);
labelSlevel.setForeground(Color.WHITE);
panelMain.add(labelSlevel);
l1 = newJRadioButton("EASY");
l1.setBounds(450,290,90,30);
l1.setForeground(Color.WHITE);
l1.setOpaque(false);
panelMain.add(l1);
l2 = newJRadioButton("MEDIUM");
l2.setBounds(450,330,90,30);
l2.setForeground(Color.WHITE);
l2.setOpaque(false);
panelMain.add(l2);
l3 = newJRadioButton("HARD");
l3.setBounds(450,370,90,30);
l3.setForeground(Color.WHITE);
l3.setOpaque(false);
panelMain.add(l3);
//////////////////////////////////// HIGHSCORES ////////////////////////////////
labelHS = newJLabel();
labelHS.setBounds(450,420,150,30);
labelHS.setText("HIGHSCORES");
labelHS.setFont(font2);
labelHS.setForeground(Color.WHITE);
panelMain.add(labelHS);
lavelEasy = newJLabel();
lavelEasy.setBounds(450,450,150,30);
lavelEasy.setText("EASY: "+HSEasy);
lavelEasy.setForeground(Color.WHITE);
panelMain.add(lavelEasy);
labelMid = newJLabel();
labelMid.setBounds(450,480,150,30);
labelMid.setText("MEDIUM: "+HSMid);
labelMid.setForeground(Color.WHITE);
panelMain.add(labelMid);
labelHard = newJLabel();
labelHard.setBounds(450,510,150,30);
labelHard.setText("HARD: "+HSHard);
labelHard.setForeground(Color.WHITE);
panelMain.add(labelHard);
////////////////////////////////////// END ////////////////////////////////////
btnExit = newJButton("EXIT");
btnExit.setBounds(450,560,80,20);
btnExit.setBackground(bg);
btnExit.addMouseListener(this);
btnExit.addActionListener(this);
panelMain.add(btnExit);
btnHelp = newJButton("HELP");
btnHelp.setBounds(570,560,80,20);
btnHelp.setBackground(bg);
btnHelp.addMouseListener(this);
btnHelp.addActionListener(this);
panelMain.add(btnHelp);
this.add(panelMain);
this.setVisible(true);
}//Constructor
//////////////////////////////////Mouse Event///////////////////////////////////
publicvoidmousePressed(MouseEventme)
{
}//mousePressed
publicvoidmouseEntered(MouseEventspme)
{
JButtonbutton = (JButton)spme.getSource();
button.setBackground(Color.GREEN);
}//mouseEntered
publicvoidmouseClicked(MouseEventme)
{
}//mouseClicked
publicvoidmouseExited(MouseEventspme)
{
JButtonbutton = (JButton)spme.getSource();
button.setBackground(bg);
}//mouseExited
publicvoidmouseReleased(MouseEventme)
{
}//mouseReleased
/////////////////////////////////// Action Performed///////////////////////////
publicvoidactionPerformed(ActionEventae)
{
if(ae.getSource().equals(btnStart))
{
if(l1.isSelected())
{
level=5;
score = 20;
MP = newMainPage(level,score);
this.setVisible(false);
}//Easy Selected
elseif(l2.isSelected())
{
level=10;
score = 25;
MP = newMainPage(level,score);
this.setVisible(false);
}//Meidum Selected
elseif(l3.isSelected())
{
level=15;
score = 30;
MP = newMainPage(level,score);
this.setVisible(false);
}//Hard Selected
else
{
JOptionPane.showMessageDialog(this,"PLEASE SELECT A LEVEL");
}//Nothing Selected
}//Start Pressed
elseif(ae.getSource().equals(btnHelp))
{
JOptionPane.showMessageDialog(this,"Every pair of box holds The same Value.Click a box to Reveal it's Value, find the other one with the same Value.");
}//Start Pressed
elseif(ae.getSource().equals(btnExit))
{
System.exit(0);
}//Start Pressed
}//actionPerformed
}//Class