swing 关闭窗口
myFrame extends JFrame?? 3种:
?
1、this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
?
2、重写JFrame的processWindowEvent方法:
protected void processWindowEvent(WindowEvent e) {
???? if (e.getID() == WindowEvent.WINDOW_CLOSING) {
?????? System.exit(0);
???? }
?}
?
3、
this.addWindowListener(new WindowAdapter(){
?????public void windowClosing(WindowEvent e) {
?????????System.exit(0);
?????}
});