my code:
public static BufferedImage grabImage(String path, int x, int y, int width, int height) {
BufferedImage tile = null;
BufferedImage bildTileset = null;
try {
bildTileset = ImageIO.read(new File(path));
} catch (IOException error) {
System.err.println("Tileset not found");
error.printStackTrace();
}
tile = bildTileset.getSubimage(x * width, y * height, width, height);
return tile;
}
//exapmple
// BufferedImage img = grabImage("res/img/img.png",0,0,16,16);
But it wont work! It loads if it is outside of the jar! How do i load it form inside the jar?