static boolean _noExit = false; static void exitOnFrameClose(JFrame frame) { if (!_noExit) frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }