开发者

How to display a new frame in an an applet?

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 开发者_Python百科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?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜