-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBoard.java
More file actions
43 lines (34 loc) · 995 Bytes
/
Copy pathBoard.java
File metadata and controls
43 lines (34 loc) · 995 Bytes
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
/**
* @Team MAGA
* @Author Gajun Young - 16440714
* @Author Royal Thomas - 16326926
* @Author Richard Otroshchenko
*/
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.*;
@SuppressWarnings("serial")
public class Board extends JPanel {
private BufferedImage boardImage;
//Constructor
public Board() {
/**
* Catch any errors if the image doesn't exist
*/
try {
boardImage = ImageIO.read(CluedoUI.class.getResourceAsStream("Board.jpg"));
} catch (IOException ex) {
System.out.println("Couldn't find image...." + ex);
}
}
//Draw the image
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
g2.drawImage(boardImage, 0, 0, boardImage.getWidth(), boardImage.getHeight(), null);
}
}