Is the [X] at the top right corner part of the JApplet or container with the JApplet?

I need to make an action happen when the user attempts to close out of the JApplet and I'm not sure of how to properly access the window-closed button within JApplet context.

Thanks again!

Edit: Sorry if I wasn't being clear. I want to access the command associated with the JApplet window-closed box. Something like a listener-command for the window associated with the JApplet's window-closed box.

-Alex

I assume you are running it in the AppletViewer? I think that close button is part of a window created by the applet viewer itself. Since applets are designed to run in a browser, they don't really have a close button themselves. They have life cycle methods that respond to browser events, like leaving the page or closing.
http://java.sun.com/docs/books/tutorial/deployment/applet/lifeCycle.html
You will probably need to put that action code in one of those life cycle methods.
(I've never had use for an applet personally so I would just imagine that would be the place to handle it)

I assume you are running it in the AppletViewer? I think that close button is part of a window created by the applet viewer itself. Since applets are designed to run in a browser, they don't really have a close button themselves. They have life cycle methods that respond to browser events, like leaving the page or closing.
http://java.sun.com/docs/books/tutorial/deployment/applet/lifeCycle.html
You will probably need to put that action code in one of those life cycle methods.
(I've never had use for an applet personally so I would just imagine that would be the place to handle it)

I feel like an idiot...

Yeah that tutorial worked. Just extended JApplet instead of Applet just to be sure, and it worked like a charm!

I'll put the code in the destroy method - I think (but am not sure) that the stop method is called when the JApplet is unfocused so I'll avoid using that for "clean up."

Thanks again XD

This question has already been answered. Start a new discussion instead.