Swing关闭窗口前提示用户

  惯例广告一发,对于初学真,真的很有用www.java1234.com,去试试吧!

 

 

int result = JOptionPane.showConfirmDialog(null, "你确定要退出本窗口不?",
    "Information", JOptionPane.YES_NO_OPTION);
  if (result == JOptionPane.YES_NO_OPTION) {
   this.dispose();
  }

posted on 2013-06-08 20:59  鱼东鱼  阅读(205)  评论(0编辑  收藏  举报

导航