单击文件菜单下的退出选项 时 程序退出!代码怎么写 谢谢!

解决方案 »

  1.   

    System.exit(0);The call System.exit(n) is effectively equivalent to the call:  Runtime.getRuntime().exit(n)
      

  2.   

    不知你要哪个?
    这是在构造函数里面写的,用于右上角的x关闭窗口
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent we) {
    System.exit(0);
    }
    });
    这个是菜单下的EXIT按钮名为miExit
    miExit.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent ae) {
    System.exit(0);
    }
    });