Closing a window
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   LUIS_GARCIA
Posted On:   Friday, April 13, 2001 01:59 PM

First I have to say that I am new to the Java world. That said, here is my question. I created an applet that is suppouse to launch a JFrame window. It does that very well. No problems. Now, when I try to close my JFrame window, it simply does not do anything. If I close the applet, then it closes. If anybody knows how to do this without having to close the applet, please let me know. In fact, here is the error message I get: Exception occurred during event dispatching: java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:272) at java.security.AccessController.checkPermission(AccessController.java:399)    More>>

First I have to say that I am new to the Java world. That said, here is my question. I created an applet that is suppouse to launch a JFrame window. It does that very well. No problems. Now, when I try to close my JFrame window, it simply does not do anything. If I close the applet, then it closes. If anybody knows how to do this without having to close the applet, please let me know.
In fact, here is the error message I get:

Exception occurred during event dispatching:
java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:272)
at java.security.AccessController.checkPermission(AccessController.java:399)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:545)
at java.lang.SecurityManager.checkExit(SecurityManager.java:765)
at java.lang.Runtime.exit(Runtime.java:91)
at java.lang.System.exit(System.java:701)
at mainApplication.exitForm(mainApplication.java:108)
at mainApplication.access$1(mainApplication.java:107)
at mainApplication$2.windowClosing(mainApplication.java:89)
at java.awt.Window.processWindowEvent(Window.java:798)
at javax.swing.JFrame.processWindowEvent(JFrame.java:241)
at java.awt.Window.processEvent(Window.java:774)
at java.awt.Component.dispatchEventImpl(Component.java:2595)
at java.awt.Container.dispatchEventImpl(Container.java:1213)
at java.awt.Window.dispatchEventImpl(Window.java:912)
at java.awt.Component.dispatchEvent(Component.java:2499)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:319)
at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:103)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:84)


Thanks,
Luis

   <<Less

Re: Closing a window

Posted By:   John_Zukowski  
Posted On:   Friday, April 20, 2001 02:03 PM

You can't call System.exit() from a frame in an applet, or anywhere for that matter....
About | Sitemap | Contact