当前位置: 代码迷 >> J2SE >> 点关闭按钮让面板封闭
  详细解决方案

点关闭按钮让面板封闭

热度:197   发布时间:2016-04-24 00:41:56.0
点关闭按钮让面板关闭!
怎么修改?

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)
方法名首字母小写
  相关解决方案