-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScorePanel.java
70 lines (50 loc) · 1.13 KB
/
ScorePanel.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
66
67
68
69
70
import javax.swing.JPanel;
import javax.swing.JLabel;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Color;
public class ScorePanel extends JPanel
{
//class constants
//class variables
private int score;
private int tries;
private JLabel lblScore;
private JLabel lblTries;
private Font font;
/***************************************/
public ScorePanel()
{
score = 0;
tries = 0;
font = new Font("Arial", Font.BOLD, 30);
setBounds(0,800, 800, 50);
lblScore = new JLabel("Score : " + score+"");
lblScore.setFont(font);
lblTries = new JLabel("Tries : " + tries+"");
lblTries.setFont(font);
add(lblScore);
add(lblTries);
}//end Constructor
public void updateScore(int inPoint)
{
score += inPoint;
lblScore.setText("Score : " + score);
}//end updateScore
public void updateTries(int inTry)
{
tries += inTry;
lblTries.setText("Tries : " + tries);
}//end updateTries
public int getScore()
{
return score;
}//end getScore
public void reset()
{
score = 0;
tries = 0;
lblScore.setText("Score : " + score);
lblTries.setText("Tries : " + tries);
}//end reset
}//end ScorePanel