Re: JPanel not visible in JApplet



James Barrett wrote:
I have narrowed it down but I don't fully understand why this is
happening. If I draw an image during the init() method nothing is
displayed, even if I put the setVisibale and setLocation method calls
before the drawImage method. But after the applet is inited, then images
can be drawn. but why? I want to display an image with out user
intervention, and as far as I know, that can only be done during init().
Is there another way?

Typically, drawing is done by paint() and not init(). init() is the code called when your applet is first invoked.

Perhaps you might want to look at
http://java.sun.com/docs/books/tutorial/uiswing/components/applet.html ?

--
Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth
.



Relevant Pages

  • Applet wont display.
    ... panel to display graphics, and the other panel displaying the controls ... my init() method has the following: ... I have embedded the applet tag in a webpage (the ...
    (comp.lang.java.gui)
  • Re: JPanel not visible in JApplet
    ... But after the applet is inited, ... I want to display an image with out user ... drawing is done by paintand not init(). ... extending JPanel and adding a Canvas, I now extend canvas and override ...
    (comp.lang.java)
  • Re: thisform.visible
    ... will not display unless there is a debugger breakpoint in the init event ... gives an internal event sequence of form Load, Init, Show, (Activate, ...
    (microsoft.public.fox.programmer.exchange)
  • Re: swsusp hangs on headless resume-from-ram
    ... I suspect it's got something to do with display ... +static void __init ... * Mark memory gaps and the reserved regions as nosave. ...
    (Linux-Kernel)
  • Re: W9xNT MCA Adapters - SPOCK-206
    ... should NOT work on Windows 95 and I want to know which messages you see ... No display delays once the driver is past the init. ...
    (comp.sys.ibm.ps2.hardware)