Img background on an applet

I have an issue with using a jpg on an applet. It displays as it should, but it coveres all of my JButtons. Here is a few lines of syntax that set the img up:

Image img;

//

//

//methods~~ blah blah

//Init() {

img = getImage( getDocumentBase(),"maelstrom2b_1025.jpg" );

//stuff

}

//paint method:

g.drawImage( img, 0, 0,this );

Can anyone tell me how to actually set it in the BACKGROUND of the applet instead of covering up my JButtons?

Thank you.

[797 byte] By [ThunderCrashera] at [2007-11-26 20:48:58]
# 1

In the future, Swing related questions should be posted in the Swing forum.

You don't override the paint() method. That is a technique for AWT applications.

You create a JPanel and override the paintComponent() method of the panel. That panel is then used as the content pane for the JApplet. You can search the Swing forum using "background image" as the keywords to find examples of this approach.

camickra at 2007-7-10 2:12:28 > top of Java-index,Java Essentials,Java Programming...