-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAboutPanel.java
More file actions
42 lines (39 loc) · 1.44 KB
/
AboutPanel.java
File metadata and controls
42 lines (39 loc) · 1.44 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
import java.awt.*;
import java.io.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.event.*;
import java.awt.Image.*;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
//Implements the About screen
public class AboutPanel extends JPanel implements ActionListener {
//Properties
private Timer aboutTimer = new Timer(1000 / 60, event -> repaint());
private JButton backButton = new JButton("BACK"); //back button
private String strfileName = "Assets/AboutPanel.png"; //about image
//Methods
@Override
public void actionPerformed(ActionEvent evt) {
if (evt.getSource() == backButton) { //if back button is pressed
Utility.changePanel(new MainMenu().getMenuPanel()); //change panel back to main menu
}
}
public void paintComponent(Graphics g) {
BufferedImage image = null;
//draw help screen image
g.drawImage(Utility.loadImage(strfileName, this.getClass()), 0, 0, null);
}
//constructor
public AboutPanel() {
//Initialize default JPanel properties
super();
//setting back button
backButton.setSize(100, 25);
backButton.setLocation(30, 20);
backButton.addActionListener(this);
Utility.setButtonStyle(backButton, 12); //setting preset button style
add(backButton); //adding backbutton to panel
aboutTimer.start();
}
}