-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScoreboard.java
More file actions
36 lines (33 loc) · 824 Bytes
/
Copy pathScoreboard.java
File metadata and controls
36 lines (33 loc) · 824 Bytes
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
import java.awt.Color;
import java.awt.BorderLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Scoreboard extends JLabel
{
JLabel score;
int currentScore;
int pointFactor;
public Scoreboard()
{
currentScore = 0;
pointFactor = 2;
score = new JLabel("SCORE: " + currentScore);
score.setFont(score.getFont().deriveFont(14.0f));
score.setForeground(Color.red);
//
}
public void updateScore()
{
currentScore += pointFactor;
score.setText("SCORE: " + currentScore);
}
public void decreaseScore()
{
currentScore -= pointFactor;
score.setText("SCORE: " + currentScore);
}
}