Error With Simply Displaying Picture
I have no clue what's wrong here. I'm starting to learn about games in Java, and I'm reading a free online tutorial. It starts with applets. On the first page, the writer tells us how to display pictures, but, for some reason, my picture isn't displaying. I've attached my code, along with a picture of the working applet. (In case it's pertinent, I'm using NetBeans.)
Dang. I can't post links or images yet. Well, I'll describe the output. The program runs fine. "Hello, World!" in green, 30-point Comic Sans MS even appears, but it appears on a white background. My picture, katsucon, is nowhere to be seen. (Yes, katsucon.jpg is in my source folder.)
public class HelloWorld extends Applet
// I recieve a "warning" unless I have the following line.
private final static long serialVersionUID = 42L;
private Font comicSansMS;
private Image katsucon;
public void init()
katsucon = getImage(getDocumentBase(), "katsucon.jpg");
setFont(new Font("Comic Sans MS", Font.BOLD, 30));
public void paint(Graphics g)
g.drawString("Hello, World!", 50, 50);
g.drawImage(katsucon, 0, 0, this);
What's wrong and how do I fix it?