Search code examples
javaswingappletjapplet

Close event for applet?


I have a JApplet that adds a JPanel. I play some music in this, but when I close the web browser Java is still running and playing music.

I couldn't find anything on this, but is there a way to override or catch the close event? I'd like to do a music.stop() or other such housecleaning to try and to get it to shutdown in a more graceful manner.


Solution

  • void destroy()
    

    Called by the browser or applet viewer to inform this applet that it is being reclaimed and that it should destroy any resources that it has allocated.

    void stop()
    

    Called by the browser or applet viewer to inform this applet that it should stop its execution.