I am writting an Applet (not a JApplet) and I have all the GUI ready,
with panels and panels inside panels. In one of this panels I need to
show an Image, but I can't work out how to do it. The image keeps
showing in the background of the applet, so the panels cover it. I have
tried:
Graphics gr=myPanel.getGraphics();
gr.drawImage(myImnage,0,0,null);
inside the paint() method, but It doesn't work.
Could you help me? I am just a beginner in Java.
Thanks
zero - 17 Dec 2005 17:02 GMT
FuzzyLogic <email@fake.is> wrote in news:S6Wof.125974$yg1.108478
@twister.auna.com:
> I am writting an Applet (not a JApplet) and I have all the GUI ready,
> with panels and panels inside panels. In one of this panels I need to
[quoted text clipped - 6 lines]
>
> inside the paint() method, but It doesn't work.
You should draw the image from within the panel's paint method, not the
applet's paint.
Panel myPanel = new Panel()
{
public void paint(Graphics g)
{
g.drawImage(myImage, 0, 0, null);
}
};
applet.add(myPanel);
I think this should work.

Signature
Beware the False Authority Syndrome