tags:

views:

39

answers:

1

Hello everyone,

I have an applet. In this I have a JLabel component. When the user clicks this label, a new JFrame component gets displayed. I want to set the value of setDefaultCloseOperation() for this frame as JFrame.EXIT_ON_CLOSE. However, I get a SecurityException if I do that. I read the documentation of JFrame.EXIT_ON_CLOSE and its written that :

The exit application default window close operation. If a window has this set as the close operation and is closed in an applet, a SecurityException may be thrown. It is recommended you only use this in an application.

What I understood from the above is that if a frame is closed without specifying default close operation, the frame is only hidden. I want to close the frame when the user tries to close it, and not hide the frame. Is this possible?

+2  A: 

You are not allowed to exit the application in an applet, Rather you can use DISPOSE_ON_CLOSE which removes the JFrame completely.

Vincent Ramdhanie