你将system.exit(0)改成this.setvisible(false)隐藏这个窗口就可以了
—————————————————————————————————Just Wish you have a nice day !

解决方案 »

  1.   

    System.exit(0)是退出该应用程序后台的JVM,这样一来就会导致其他的窗口也会被关闭。你用this.dispose()方法关闭这个窗口好了。这样只会使这个窗口关闭并被回收资源,而不会影响其它的。
      

  2.   

    试过了,出错,我也以为可以这样的,可编译以后说
    说this在这里不能用,你们不信试试看
      

  3.   

    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE );System.exit(0); --> this.dispose();
      

  4.   

    你用了 inner class 当然 this 不好用了
      

  5.   

    把 this.dispose(); 放到另一个函数里
    然后在 public void windowClosing(WindowEvent e) 里面调用
      

  6.   

    我改了以后出现以下错误
    addWindowListen cannot be applied to JFrame1我的代码改动如下
            setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE );
    addWindowListener(this);public void windowClosing(WindowEvent e){
      this.dispose()
    }
      

  7.   

    不是这个意思
    这样做addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent e){
      DisposWin(e);
    }
    });private void DisposWin(WindowEvent e){
      this.dispose();
    }
      

  8.   

    非常感谢telenths(_非法操作_) ,
    同时一并感谢上面的朋友们,谢谢,马上
    揭帖散分