Thanks a lot! I also noticed that as soon as I put the applet into a Web page (making it visible) then the problem went away. I should have went straight for the API. (Boy, I feel like an idiot now.) But thanks so much, CommanderKeith!
PS- I tried making my applet visible before calling createImage() and I am no longer getting the NullPointerException. However, I got another NullPointerException at a later point in my code.
public static final int MENU=0, MAINMENU=0;
ImageIcon menupix=new ImageIcon;
if(state==MENU) menupix[MAINMENU].paintIcon(this,g,0,0); //this line is the culprit
This is a (rather condensed) version of my code that's giving me a hard time. I've crawled through the API but could not find anything pertaining to the situation. It won't tell me what the NullPointerException is, either, but I'm pretty sure it's referring to the ImageIcon. This was called from a JApplet's Paint method. All of the declarations were outside of any methods I had. Setting menupix
was in my applet's init() method. Thanks a lot for putting up with me and my stupid questions.