public class AwtDemo {
public static void main(String[] args) {
// TODO Auto-generated method stub
Frame f = new Frame();
f.setVisible(true);
f.setSize(500, 400);
f.setLayout(new FlowLayout());
f.setLocation(300, 200);
Button b = new Button("anniu");
f.add(b);
f.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
}
}
f.addWindowListener(new WindowAdapter()
这句话为什么要new 一个对象呢?求解释 |