File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes Frame invoked on an Applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Frame invoked on an Applet" Watch "Frame invoked on an Applet" New topic
Author

Frame invoked on an Applet

Vardan Gupta
Greenhorn

Joined: Jun 02, 2009
Posts: 11
I was trying to make an applet which invokes a frame, and frame is implementing WindowListener and ActionListener but it gives an exception
Exception in thread "AWT-EventQueue-1" java.security.AccessControlException
the coding done in listener is {System.exit(1);}
please help me out, i m a beginner in java.

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41621
    
  55
Please post the full stack trace of the exception.

You can't attach source files, you'll need to post a relevant excerpt here. Be sure to use CODE tags for any code you post.


Ping & DNS - my free Android networking tools app
Vardan Gupta
Greenhorn

Joined: Jun 02, 2009
Posts: 11
Vardan Gupta wrote:I was trying to make an applet which invokes a frame, and frame is implementing WindowListener and ActionListener but it gives an exception
Exception in thread "AWT-EventQueue-1" java.security.AccessControlException
the coding done in listener is {System.exit(1);}
please help me out, i m a beginner in java.

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41621
    
  55
Well, quoting your entire previous post without adding any new information didn't exactly make things clearer, but do you mean to say you're calling System.exit() in an applet? If so, that's neither allowed, nor would it work if it was allowed. The JVM is under the control of the browser, not the applet. What are you trying to achieve by calling that method?
Vardan Gupta
Greenhorn

Joined: Jun 02, 2009
Posts: 11
leave all that, i just want to ask one thing that, if we use System.exit(1) as a body in any funcion then all the opened frames get lost, but suppose if we are having 1 applet window opened and 1 frame window opened in the same program and we are using aforesaid then there arise a problem, which i mentioned in my previous post.
Thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41621
    
  55
Ulf Dittmer wrote:you're calling System.exit() in an applet? If so, that's neither allowed, nor would it work if it was allowed. The JVM is under the control of the browser, not the applet.

If you want to close windows, then you'll have to keep references to them so that you can call their dispose() method at appropriate times.
 
wood burning stoves
 
subject: Frame invoked on an Applet