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

点关闭按钮让面板关闭!
怎么修改?

Java code

import java.awt.event.*;
import java.awt.*;

class TestStopWatch extends Frame
{
    public TestStopWatch()
    {
        addWindowListener(new WindowAdapter()
        {
            public void WindowClosing(WindowEvent e)
            {
                dispose();
                System.exit(0);
            }
        });
    }
    public static void main(String []args)
    {
        TestStopWatch sw=new TestStopWatch();
        sw.setSize(400,400);
        sw.setVisible(true);
    }
}




------解决方案--------------------
public void WindowClosing(WindowEvent e)

改为public void windowClosing(WindowEvent e)
方法名首字母小写