当前位置: 代码迷 >> J2SE >> 为何关不掉窗口呢
  详细解决方案

为何关不掉窗口呢

热度:128   发布时间:2016-04-23 22:52:31.0
为什么关不掉窗口呢
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()这方法首字母小写
  相关解决方案