Skip to content

Commit 687e4e3

Browse files
committed
Another attempt
1 parent 233b830 commit 687e4e3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/main/java/net/rptools/lib/swing/PaintedPanel.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import java.awt.Dimension;
1818
import java.awt.Graphics;
1919
import java.awt.Graphics2D;
20+
import java.awt.Image;
2021
import java.awt.Paint;
2122
import java.awt.Rectangle;
2223
import java.awt.TexturePaint;
@@ -26,13 +27,12 @@
2627
import java.net.URL;
2728

2829
import javax.imageio.ImageIO;
30+
import javax.swing.ImageIcon;
2931
import javax.swing.JPanel;
3032

3133
@SuppressWarnings("serial")
3234
public class PaintedPanel extends JPanel {
33-
34-
private final URL urlTexture = PaintedPanel.class.getResource("/net/rptools/lib/image/icons/transparent2.png");
35-
35+
3636
private Paint paint;
3737

3838
public PaintedPanel() {
@@ -67,7 +67,7 @@ protected void paintComponent(Graphics g) {
6767
} else {
6868
try {
6969
BufferedImage texture;
70-
texture = ImageIO.read(new File(urlTexture.getFile()));
70+
texture = ImageIO.read(getClass().getResource("/net/rptools/lib/image/icons/transparent2.png"));
7171
TexturePaint tp = new TexturePaint(texture, new Rectangle(0, 0, 28, 28));
7272
((Graphics2D) g).setPaint(tp);
7373
g.fillRect(0, 0, size.width, size.height);

0 commit comments

Comments
 (0)