File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Applets and the fly likes New Window in destroy() ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "New Window in destroy() ? " Watch "New Window in destroy() ? " New topic

New Window in destroy() ?

Jeff Vendetti

Joined: Oct 09, 2001
Posts: 3
Is it possible to open a new browser window in the destroy() method of an applet? I can check to see if anything's changed, and then ask the user if they want to save, and, if so, re-open the applet to allow them to save it. Can this be done?
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Jeff,
I see 2 problems with that approach.
1. Destroy is called when the browser doesn't need your applet anymore. This is the case when the browser is closed or when the browser clears its cache. With both cases, another window will not be seen because the parent (applet or broswer) will be gone anyway.
2. Destroy is supposed to be called when the browser doesn't need an applet anymore. With browser caches, it is not exactly clear when a browser will not need an applet anymore.
The destroy method is really for an applet to clean up memory resources and kill running threads that it might have spawned, etc.
I agree. Here's the link:
subject: New Window in destroy() ?
It's not a secret anymore!