-
Notifications
You must be signed in to change notification settings - Fork 1
/
scorePane.java
65 lines (47 loc) · 1.78 KB
/
scorePane.java
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
import java.awt.event.ActionEvent;
import javax.swing.*;
import java.awt.* ;
import javax.swing.border.LineBorder;
import javax.swing.border.SoftBevelBorder;
class scorePane extends JPanel {
JButton playAgain ,
exit ;
JLabel scoreLabel ;
static boolean again =false;
scorePane (JFrame window , int score , int nbrQ) {
setSize(window.getSize().width,window.getSize().height);
setLayout(null);
setBackground(Color.DARK_GRAY);
window.setContentPane(this);
playAgain = new JButton ("Back To Menu");
playAgain.setBackground(new Color(255,255,255)) ;
playAgain.setBounds(300,250,200,50);
add(playAgain);
exit = new JButton ("Exit");
exit.setBackground(new Color(255,255,255)) ;
exit.setBounds(300,350,200,50);
add(exit);
scoreLabel = new JLabel ("You Got : "+score+"/"+nbrQ);
scoreLabel.setHorizontalAlignment(JLabel.CENTER);
scoreLabel.setFont(new Font("Verdana", Font.BOLD, 40));
scoreLabel.setForeground(Color.white);
scoreLabel.setBorder(new LineBorder(Color.white, 2, true));
scoreLabel.setBounds(200,100,400,100);
add(scoreLabel);
window.setVisible(true);
}
void choose () {
playAgain.addActionListener((ActionEvent e) -> {
again= true ;
});
exit.addActionListener((ActionEvent e) -> {
System.exit(0);
});
while (!again) {
try {
Thread.sleep(0);
} catch (InterruptedException ex) {}
}
again = false ;
}
}