日期:2014-05-20  浏览次数:20648 次

为什么关不掉窗口呢
import java.awt.event.*;
import java.awt.*;
public class Inet
{
public static void main(String[] args)
{
Frame frame=new Frame("awt");
frame.setSize(500,400);
frame.setLocation(300,200);
frame.setLayout(new FlowLayout());
Button b=new Button("我是一个按钮");
frame.add(b);
frame.addWindowListener(new WindowAdapter()
{
public void WindowClosing(WindowEvent e)
{
System.exit(0);
}
}
);
frame.setVisible(true);
}
}
class MyWin extends WindowAdapter
{
public void WindowClosing(WindowEvent e)
{
System.exit(0);
}
}

------解决方案--------------------
WindowClosing改为windowClosing.
------解决方案--------------------
一楼说的没错,WindowClosing()这方法首字母小写