|
-
pb using a button in an applet
Hi all,
i'm a beginner in java and i have a problem:
i create an applet with a nice picture and a button. All works well when i compile and execute the appletviewer.
But once i click on the button i have a lot of error messages like:
Exception in thread "AWT-EventQueue-1" java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
at java.security.AccessController.checkPermission(AccessController.java:427)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.lang.SecurityManager.checkExit(SecurityManager.java:744)
at java.lang.Runtime.exit(Runtime.java:88)
....
Would someone have one idea about ? Thanks very much.
i give you my simple code:
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class Fenetre extends Applet implements ActionListener {
public final static int HT= 300;
public final static int LG = 300;
public void init(){
Dessin D;
setSize(LG,HT);
setBackground(Color.gray);
setLayout(new BorderLayout());
// addWindowListener(new GestionBoutons());
add(D = new Dessin(), "Center");
Button bQuitter = new Button ("Quitter");
bQuitter.addActionListener(this);
add(bQuitter,"South");
}
public void actionPerformed(ActionEvent evt) {
System.exit(0);
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks