-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCongratsMenu.java
More file actions
70 lines (65 loc) · 1.97 KB
/
CongratsMenu.java
File metadata and controls
70 lines (65 loc) · 1.97 KB
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 java.awt.*;
import javax.swing.*;
public class CongratsMenu {
/**
* Congrats class of Slide Into Highschool, shows congratulations message for games
*
* <h2>Course Info:</h2>
* ICS4UP with Krasteva, V.
* Date: June 5st, 2023
* Time Spent: 0.5 hrs
* @version 1
* @author Charlie To, Milena Mofrad
*/
/** Holds the frame*/
JFrame frame;
/** Holds the text for congratulations screen*/
String text;
/** Holds the text for congratulations screen*/
String text2 = "press space to continue";
public CongratsMenu(JFrame frame, String text){
this.frame = frame;
this.text = text;
// Clear the frame
Container contentPane = frame.getContentPane();
contentPane.removeAll();
this.frame.revalidate();
this.frame.repaint();
MainMenu.setIsCongratsMenu(true);
}
/**
* Constructor method
*
* @param frame, text, text2, takes frames and texts to display
* @return name Function
*/
public CongratsMenu(JFrame frame, String text, String text2){
this.frame = frame;
this.text = text;
this.text2 = text2;
// Clear the frame
Container contentPane = frame.getContentPane();
contentPane.removeAll();
this.frame.revalidate();
this.frame.repaint();
MainMenu.setIsCongrats(true);
}
public void run(){
frame.getContentPane().add(new Drawing());
frame.setVisible(true);
}
class Drawing extends JComponent {
public void paint(Graphics g) {
super.paintComponent(g);
// BACKGROUND
g.setColor(Colours.backgroundBlue);
g.fillRect(0, 0, getWidth(), getHeight());
// NUMBERS
g.setColor(Color.WHITE);
g.setFont(new Font("Roboto", Font.PLAIN, 30));
g.drawString("Congrats!", 100, 130);
g.drawString(text, 100, 170);
g.drawString(text2, 100, 210);
}
}
}