File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Applets and the fly likes Reloading Applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Reloading Applet" Watch "Reloading Applet" New topic

Reloading Applet

Saulo Menezes

Joined: Jan 15, 2003
Posts: 17
Hi everyone!
I have been searching for a while for a code that would let me reload my Applet, but I haven't found anything really. Would anyone be able to tell me if there's a code that would allow that to happen.
It's just that I've created an Applet and there's a button whose event handler must restart the whole Applet but up to now it's not operating at all. I would be grateful if somebody could answer me this.
Sanjeev Kaushik
Ranch Hand

Joined: Aug 01, 2002
Posts: 105
If you look at the life cycle of applet, which is as under
init() -> start() -> stop() -> destroy()
once applet is loaded, browser(applet container) calls init() method of that applet. After this start() method. If applet is behind the screen browser may call stop() method. And browser is closed browser call the destroy method. Once this window comes in focus, start() method is again called. In this cycle init() is called only once.
So as you said you have put a button to reload the applet. If you are calling init() explicitly method on the event of that button, it must reinitialize the applet.
Sanjeev Kaushik
subject: Reloading Applet
It's not a secret anymore!