Skip to content

Commit 591df5a

Browse files
author
tuval88
committed
use correct image path
1 parent 7605115 commit 591df5a

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/main/java/gui/PathMaker.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
import java.awt.image.BufferedImage;
1111
import java.io.File;
1212
import java.io.IOException;
13+
import java.net.URL;
14+
import java.net.URLClassLoader;
15+
import java.util.Objects;
1316
import java.util.Stack;
1417

1518
/**
@@ -50,7 +53,7 @@ protected void paintComponent(Graphics g) {
5053
super.paintComponent(g);
5154
BufferedImage img;
5255
try {
53-
img = ImageIO.read(new File("src/main/resources/HalfField.png"));
56+
img = ImageIO.read(Objects.requireNonNull(getClass().getResource("/res/HalfField.png")));
5457
g.drawImage(img, 0, 0, null);
5558
} catch(IOException ignored) {
5659
// If the field image cannot be found, do not draw a background.
File renamed without changes.

0 commit comments

Comments
 (0)