-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInstructions.java
More file actions
64 lines (58 loc) · 1.68 KB
/
Instructions.java
File metadata and controls
64 lines (58 loc) · 1.68 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
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
public class Instructions {
/**
* Instructions class of Slide Into Highschool, gives instructions for game
*
* <h2>Course Info:</h2>
* ICS4UP with Krasteva, V.
* Date: June 5st, 2023
* Time Spent: 0.5 hrs
* @version 1
* @author Charlie To, Milena Mofrad
*/
JFrame frame;
/**
* Constructor method
*
* @param frame Takes JGrasp frame
*/
public Instructions(JFrame frame) {
this.frame = frame;
// Clear the frame
Container contentPane = frame.getContentPane();
contentPane.removeAll();
this.frame.revalidate();
this.frame.repaint();
MainMenu.setIsInstruction(true);
}
/**
* runs instructions
*/
public void run() {
frame.setLayout(new BorderLayout());
frame.getContentPane().add(new Drawing());
JButton exit = new JButton("exit");
frame.add(exit, BorderLayout.SOUTH);
frame.setVisible(true);
exit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
MainMenu.setIsInstruction(false);
System.out.println("exit clicked");
MainMenu ex = new MainMenu(frame);
ex.run();
}
});
}
class Drawing extends JComponent {
public void paint(Graphics g) {
super.paintComponent(g);
g.setColor(Colours.backgroundBlue);
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(Color.WHITE);
g.setFont(new Font("Serif", Font.PLAIN, 40));
g.drawString("Instructions", 300, 75);
}
}
}