How to detect Applet has been stopped or killed...

Hello,

I'm working on a Swing Applet that creates Annotations

I want to detect when the browser or Applet have been killed so that i can save the Annotation objects into XML format.

currently I have put the code to save the Annotations into XML format in the stop() method but this does not seem to be called. does this method get called automatically? or do I have to manually call it?

[426 byte] By [asammahmood] at [2007-9-26 1:47:48]
# 1
Please someone help me... I'm a fellow programmer in need of help... I'm a comrade you gotta help me. Pretty please?
asammahmood at 2007-6-29 2:47:18 > top of Java-index,Archived Forums,Swing...
# 2
Someone please help.... I'm desperate.... <crying silently.....>
asammahmood at 2007-6-29 2:47:18 > top of Java-index,Archived Forums,Swing...
# 3

You may want to try using the destroy method rather than the stop method. Both stop and destroy are automatically called. Stop code is executed everytime the user leaves the page containing the applet, destroy is called when the browser exits. Java guarantees to call this method when the browser shuts down normally.

The problem is probably a security issue tho. Have you given the applet sufficent rights to write the annotations file to the location it has chosen?

And finally, if your not sure if the stop code is being executed why not make it pop up a dialog box or something to show that it's executing the code? It's more likely to be able to complete a dialog box command without error than file writing commands, ne?

Hope this helps.

rhianan at 2007-6-29 2:47:18 > top of Java-index,Archived Forums,Swing...
# 4
I've done that but nothing happens... it doesn't appear to call the stop method or the destroy method.I've put in a popup but it doesn't appear...can someone give me an example of how to utilise these methods? or tell me how to figure out the Applet page has left?
asammahmood at 2007-6-29 2:47:18 > top of Java-index,Archived Forums,Swing...