how to set an image as background for a jPanel in an applet

hi, I want to set an image as background for a jPanel component in an applet. I am using netbeans environment. I found that to set an image as a background for a jPanel is not possible. Could someone help me . Thanks in advance,Joshua
[262 byte] By [joshuaRa] at [2007-10-3 3:47:02]
# 1

public class ImagePanel extends JPanel

{

private Image image = null;

public void setImage(Image image)

{

this.image = image;

}

protected void paintComponent(Graphics g)

{

super.paintComponent(g);

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

}

}

Adjust to taste.

itchyscratchya at 2007-7-14 21:43:54 > top of Java-index,Desktop,Core GUI APIs...
# 2
I already have an image .How do i nclude that image into the code that yoyu have submitted.?Thanks in advance
joshuaRa at 2007-7-14 21:43:54 > top of Java-index,Desktop,Core GUI APIs...
# 3
Isn't that blindingly obvious?
itchyscratchya at 2007-7-14 21:43:54 > top of Java-index,Desktop,Core GUI APIs...
# 4
> Isn't that blindingly obvious? I thought so!
camickra at 2007-7-14 21:43:54 > top of Java-index,Desktop,Core GUI APIs...