- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWinPage.java
More file actions
Latest commit
101 lines (82 loc) · 2.8 KB
/
Copy pathWinPage.java
File metadata and controls
101 lines (82 loc) · 2.8 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
importjava.lang.*;
importjava.awt.*;
importjavax.swing.*;
importjava.awt.event.*;
publicclassWinPageextendsJFrameimplementsActionListener,MouseListener
{
privateJPanelpanelMain;
privateJLabellabel1,labelScore;
privateJButtonbtnAgain,btnExit;
privateColorcolorBG = newColor(36, 64, 109);
privateColorbg = newColor(155, 242, 157);
privateFontfont1 = newFont("Consolas", Font.BOLD | Font.ITALIC, 40);
intTscore;
WinPage(intTscore)
{
super("Puzzle Game");
this.setSize(600,400);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
panelMain = newJPanel();
panelMain.setBackground(colorBG);//Main Panel
panelMain.setLayout(null);
label1 = newJLabel();
label1.setBounds(200,50,350,60);
label1.setForeground(Color.WHITE); // WIN LABEL
label1.setText("YOU WIN");
label1.setFont(font1);
panelMain.add(label1);
this.Tscore = Tscore;
labelScore = newJLabel();
labelScore.setBounds(200,120,350,20);
labelScore.setForeground(Color.WHITE); // SCORE LABEL
labelScore.setText("Your Score: "+Tscore);
panelMain.add(labelScore);
btnAgain = newJButton("AGAIN");
btnAgain.setBounds(200,150,70,30);
btnAgain.setBackground(bg); // AGAIN BUTTON
btnAgain.addActionListener(this);
btnAgain.addMouseListener(this);
panelMain.add(btnAgain);
btnExit = newJButton("EXIT");
btnExit.setBounds(280,150,70,30);
btnExit.setBackground(bg); // EXIT BUTTON
btnExit.addActionListener(this);
btnExit.addMouseListener(this);
panelMain.add(btnExit);
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 EVENT /////////////////////////////////////
publicvoidactionPerformed(ActionEventwpae)
{
if(wpae.getSource().equals(btnAgain))
{
this.setVisible(false);
StartPagesp = newStartPage();
}// Again Button
elseif(wpae.getSource().equals(btnExit))
{
System.exit(0);
}// Exit Button
}// ActionPerformed
}//Class