Basically here's the deal, I'm trying to load an image from a source file within the Project, but whenever I run the code nothing happens.
Can anyone shed some light on where I am going wrong, and maybe possibly how to get it to draw correctly?
Here's the code:
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
public class EnterTile extends Tile {
public EnterTile() {
setTile();
}
public void setTile() {
try {
BufferedImage img = ImageIO.read(new File("res\\BrokenFenceSwamp.gif"));
Graphics g = img.getGraphics();
g.drawImage(img, 1000, 1000, 8, 8, null);
} catch (IOException e) {
System.out.println("Error " + e);
}
}
public static void main(String args[]) {
EnterTile enterTile = new EnterTile();
}
}
Thanks for taking the time to read this.