📄 sameapplettest1.java.bak
字号:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.util.Enumeration;
/**SameAppletTest1类是Applet子类,并实现了ActionListener接口*/
public class SameAppletTest1 extends Applet implements ActionListener{
private TextArea taObj;
private String strObj;
/**方法init()*/
public void init(){
Button butObj = new Button("Click to call getApplets()");
butObj.addActionListener(this);
setLayout(new BorderLayout());
add("South",butObj);
taObj = new TextArea(5,40);
taObj.setEditable(false);
add("Center",taObj);
}
public void actionPerformed(ActionEvent event){
printApplets();
}
public void printApplets(){
Enumeration e = getAppletContext().getApplets();
taObj.append("**************************\n");
taObj.append("Results of getApplets():\n");
while(e.hasMoreElements()){
Applet appObj = (Applet)e.nextElement();
String info = ((Applet)appObj).getAppletInfo();
taObj.append("-"+appObj.getClass().getName()+"\n");
}
taObj.append("**************************\n\n");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -