-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainFrame.java
48 lines (43 loc) · 1.16 KB
/
MainFrame.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
//class for the main frame of the program, which houses all panels
import java.awt.*;
import javax.swing.*;
public class MainFrame extends JFrame
{
ScorePanel scorePanel;
public MainFrame()
{
//call super constructor and set this frame's title
super("Osu Mania Clone");
//create the HighwayPanel
HighwayPanel highwayPanel = new HighwayPanel(this);
add(highwayPanel);
//create the ScorePanel
scorePanel = new ScorePanel();
add(scorePanel, BorderLayout.EAST);
//set the appearance and behavior of this frame
pack();
setDefaultCloseOperation(EXIT_ON_CLOSE);
setResizable(false);
setVisible(true);
}
public void updateAccuracy(double accuracy)
{
scorePanel.updateAccuracy(accuracy);
}
public void updateHit(int hitCount)
{
scorePanel.updateHit(hitCount);
}
public void updateMiss(int missCount)
{
scorePanel.updateMiss(missCount);
}
public void updateScore(int score)
{
scorePanel.updateScore(score);
}
public static void main(String[] args)
{
new MainFrame();
}
}