伙计们正在尝试关闭小程序中的框架...我的程序正在运行,但问题是将在小程序中创建的框架没有关闭...我该怎么办...它在关闭框架窗口时给了我异常:
C:\jdk1.6.0\bin>appletviewer me.java
Exception in thread "AWT-EventQueue-1" java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323) at
java.security.AccessController.checkPermission(AccessController.java:546)
这是我的代码:
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
/*<applet code="me.class" height=500 width=500></applet>*/
class se extends Frame {
String msg;
public se() {
msg="This is Frame";
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
}
public void paint(Graphics g) {
g.drawString(msg,10,100);
}
}
public class me extends Applet {
public void init() {
se s1=new se();
s1.setSize(400,400);
s1.setVisible(true);
s1.setTitle("The JAVA GAMER");
}
public void paint(Graphics g) {
g.drawString("This is Applet",10,100);
}
}