Applet Import Image - How to?
So, i'm pretty new to java, and i just jumped into applets. And image importing might function the same way whenever it's and applet or not, but i can't seem to get it right, i've searched, but i haven't found anything that worked, or it was too complicated for me to duplicate.
So my question is, how do i import an image, the code i have so far gives no errors, but it's just blank.
So could anyone explain or show how to import images, i would be greatful!
import java.awt.Image; // Tried import Image MyImage too, but gave an error.
public class HelloWorld extends Applet
private static final long serialVersionUID = 1L;
public void init()
MyImage = getImage(getCodeBase(),"003.JPG");
public void paint (Graphics g)
Best Regards Naxix
Re: Applet Import Image - How to?
A better way of loading images is by using BufferedImages and loading them using ImageIO.read();
image = ImageIO.read(new File("filname");