Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

New Window in destroy() ?  RSS feed

 
Jeff Vendetti
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Regards,
Manfred.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!