我想窗体上单击右上角的关闭按钮时出现“确定要退出吗?”的对话框,当点击“否”时不退出程序,点击“是”退出程序。但是使用下面代码点击“否”后还是关闭了程序主窗体但并未退出程序?请高手指点。    this.addWindowListener(new WindowAdapter(){
      public void windowClosing(WindowEvent e){
        int x=JOptionPane.showConfirmDialog(null,"确定要退出吗?", "系统退出提     示!",JOptionPane.YES_NO_OPTION,JOptionPane.INFORMATION_MESSAGE);        if(x==0)
          System.exit(0);
     }
   });