当前位置: 技术问答>java相关
奇怪,为什么不能退出程序???????????????
来源: 互联网 发布时间:2015-03-09
本文导语: import javax.swing.*; import java.awt.event.*; public class MyExit extends JFrame { public static void main(String[] args) { JFrame my=new MyExit(); my.show(); } public MyExit() { setSize(200,200); addWindowListener(new WindowAdapter() ...
import javax.swing.*;
import java.awt.event.*;
public class MyExit extends JFrame
{
public static void main(String[] args)
{
JFrame my=new MyExit();
my.show();
}
public MyExit()
{
setSize(200,200);
addWindowListener(new WindowAdapter()
{public void WindowClosing(WindowEvent e)
{System.exit(0);}
});
}
}
|
WindowClosing不对,应该是windowClosing
注意大小写
注意大小写