相关文章推荐
奔跑的茄子  ·  C# ...·  3 天前    · 
重感情的大象  ·  Mysql中autocommit的用法 - ...·  5 小时前    · 
帅气的水桶  ·  [Solved] Align & ...·  6 月前    · 
笑点低的西红柿  ·  php ...·  1 年前    · 
胆小的电影票  ·  如何重命名 Pandas ...·  1 年前    · 
this.addWindowListener(this);
  //按关闭按钮,啥事也不做
this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);

3、实现windowClosing方法

* 关闭主窗口处理 @Override public void windowClosing(WindowEvent e) { int option = JOptionPane.showConfirmDialog( this , "确定退出系统?", "提示" , JOptionPane.YES_NO_OPTION); if (option == JOptionPane.YES_OPTION) if (e.getWindow() == this ) { this .dispose(); System.exit( 0 ); } else { return ; else if (option == JOptionPane.NO_OPTION){ if (e.getWindow() == this ) { return ;