How to trap applet window closing event?

Hi all,

I would like to know how could one trap the event of the browser window containing an applet being closed by the user?

Thank you,

[157 byte] By [anamupotaa] at [2007-11-27 10:19:29]
# 1

Hi. this would be useful to me too.

Trouble is, I'm not sure that you can. applet.stop( ) and applet.destroy( ) might be called, but there is no guarentee that you can complete processing before you are terminated, especially if you need to do something slow, like returning state data to your server. And you can't stop the broswer closing.

I know that in Javascript, you can catch and even stop the browser window being closed, which is how things like goggledocs can ask for confirmation before closing. (window.onbeforeunload( ) ).

I have toyed with the idea of having a javascript/ajax thread in my html, to catch this termination, and communicate back to the server from java to say a document has changed, but it all seems rather heavyweight for such a simple task.

GeoffTitmussa at 2007-7-28 16:57:58 > top of Java-index,Desktop,Core GUI APIs...