public Image getImage(String s) {
try {
URL url = new URL(getCodeBase(), s);
if (url == null) {
System.out.println("Image not in jar");
url = getClass().getResource("/"+s);
}
Image image = null;
try {
image = ImageIO.read(url);
} catch (Exception e) {
url = getClass().getResource("/"+s);
image = super.getImage(url);
}
// wait for image to load
MediaTracker tracker = new MediaTracker(this);
tracker.addImage(image, 0);
tracker.waitForAll();
return image;
} catch (Exception e) {
e.printStackTrace();
/* */
}
return null;
}
this is a fix, except that it looks outside the jar first. Im sure there is a better solution as this is rushed, but this works at least.
1 idea is an optional boolean tag in the paramaters for "custom image" otherwise look in jar.
yet im sure there is a better way
getClass().getResource("/"+s);
was causing the popup