-
Notifications
You must be signed in to change notification settings - Fork 0
/
ScoreBoardFrame
98 lines (69 loc) · 1.95 KB
/
ScoreBoardFrame
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
package Com.Game;
import java.awt.Button;
import java.awt.Color;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Label;
import java.awt.Rectangle;
import java.awt.Window;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class ScoreBoardFrame extends JPanel implements MouseListener{
private static ScoreBoardFrame scoreBoardFrame = new ScoreBoardFrame();
private ShowHighScore showHighScore = new ShowHighScore();
static JFrame frame = new JFrame("Score Board");
private DisplayButton displayButton = new DisplayButton();
Boolean status = false;
public static void setUp() {
frame = new JFrame("Score Board");
frame.addMouseListener(scoreBoardFrame);
frame.getContentPane().add(scoreBoardFrame);
frame.setSize(550, 400);
frame.setVisible(true);
frame.setResizable(false);
}
public static void main(String[] args) {
setUp();
}
public void paint(Graphics g) {
super.paint(g);
Font fnt0 = new Font("Comic Sans", Font.CENTER_BASELINE, 30);
g.setFont(fnt0);
g.setColor(new Color(197, 155, 48));
g.drawString("Score Board", 180, 70);
displayButton.render(g);
showHighScore.render(g);
}
@Override
public void mouseClicked(MouseEvent e) {
// TODO Auto-generated method stub
}
//public Rectangle back = new Rectangle(230, 200, 80, 30);
@Override
public void mousePressed(MouseEvent e) {
int mx = e.getX();
int my = e.getY();
if(mx >= 230 && mx <= 310) {
if(my >= 200 && my <= 280) {
Game.setUpGUI();
}
}
}
@Override
public void mouseReleased(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseEntered(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseExited(MouseEvent e) {
// TODO Auto-generated method stub
}
}