-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCredits.java
49 lines (37 loc) · 1.24 KB
/
Credits.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
49
import java.awt.Graphics;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.io.File;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.awt.Font;
public class Credits extends JPanel{
private static JFrame endScreen = new JFrame();
private static BufferedImage background;
private static void setImages(){
try {
background = ImageIO.read(new File("gameOverIcon.png"));
}
catch (IOException ex){System.out.println("File not found!");}
}
public static void runCredits(){
setImages();
Credits endMenu = new Credits();
endScreen.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
endScreen.setLocationRelativeTo(null);
endScreen.setLocation(0,0);
endScreen.setResizable(false);
endScreen.setVisible(true);
endScreen.setSize(520, 670);
endScreen.add(endMenu);
}
public void paintComponent(Graphics g){
super.paintComponent(g);
g.setColor(Colour.beige);
g.fillRect(0, 0, 520, 670);
g.setColor(Colour.grey);
g.setFont(new Font("Impact", Font.BOLD, 30));
g.drawImage(background, Const.screenHeight / 2 - background.getWidth(), 0, null);
}
}