...................... Importing images.
I know there are a hundred billion tutorials on this but, naturally, NONE of them are working for me. Where do I put an image to make it work with my code??? Does it need to be a certain format? I've been using .png and .gif images, but apparently they are a format not created or known on earth.
I've tried putting the images in the src folder of the workspace. I've tried creating a 'resources' folder and using ...("resources/theimagethatwillneverbeloaded.whateverextensionher e")
I've tried putting my image drawing code in every fathomable line of space in my code.
I never see the image drawn... I've tried toolkits, imageios, drawing, importing... nothing works. here's the code I have so far. I can't really get any further without ya know, actually having something drawn on screen.
public class animation extends JApplet implements KeyListener, MouseListener
//I've tried putting the image initialisation code here.
//I've tried it here!
public void init()
//Doesn't work if it's in here...
public void paint(Graphics Graph)
Image img = Toolkit.getDefaultToolkit().createImage("resources/battleship2.gif");
//and this certainly isn't working either.
//Graph.fillRect(0,0, getWidth(), getHeight());
Graph.drawImage(img, 0,0, null);
//Down here? Nope.