大家帮忙看看这段代码错在哪?
import java.awt.*;
import java.awt.event.*;
public class FrameTest {
public static void main(String[] args) {
Frame f = new Frame();
f.setSize(600,400);
f.setLocation(100,100);
Button btn1 = new Button("北");
Button btn2 = new Button("南");
Button btn3 = new Button("西");
Button btn4 = new Button("东");
Button btn5 = new Button("中间");
f.setLayout(new BorderLayout(10,10));
f.add(btn1,"North");
f.add(btn2,"South");
f.add(btn3,"West");
f.add(btn4,"East");
f.add(btn5,"Center");
f.setBackground(Color.BLUE);
f.setVisible(true);
f.addWindowListener(new MyWindowListener());
}
}
class MyWindowListener implements WindowListener {
void windowOpened(WindowEvent e) {
}
void windowClosing(WindowEvent e) {
System.exit(0);
}
void windowClosed(WindowEvent e) {
}
void windowIconified(WindowEvent e) {
}
void windowDeiconified(WindowEvent e) {
}
void windowActivated(WindowEvent e) {
}
void windowDeactivated(WindowEvent e) {
}
}
private,千里冰封,水影月圆,你们的QQ号码多少啊,我要拜师~!