我写的代码于下:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class Test5 extends Applet implements ActionListener {
Checkbox subject1, subject2, subject3, subject4;
String Str1 = new String("");
public void init() {
Label L1 = new Label("姓名");
Label L2 = new Label("学号");
Label L3 = new Label("性别");
Label L4 = new Label("年龄");
TextField f1=new TextField("",10);
TextField f2=new TextField("",10);
TextField f3=new TextField("",10);
TextField f4=new TextField("",10);
Button Button1 = new Button("添加");
Button Button2 = new Button("删除");
Button Button3 = new Button("修改");
Button Button4 = new Button("查询");
add(L1);
add(f1);
add(L2);
add(f2);
add(L3);
add(f3);
add(L4);
add(f4);
add(Button1);
add(Button2);
add(Button3);
add(Button4);
Button1.addActionListener(this);
}
public void actionPerformed(ActionEvent event) {
repaint();
}
}