diff -r 20892a2bbcbc -r f9578ba3a2c1 jdk/src/share/classes/javax/swing/JFrame.java --- a/jdk/src/share/classes/javax/swing/JFrame.java Wed Feb 13 12:38:28 2013 -0800 +++ b/jdk/src/share/classes/javax/swing/JFrame.java Fri Feb 15 14:24:42 2013 +0400 @@ -387,13 +387,14 @@ operation != EXIT_ON_CLOSE) { throw new IllegalArgumentException("defaultCloseOperation must be one of: DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE, DISPOSE_ON_CLOSE, or EXIT_ON_CLOSE"); } + + if (operation == EXIT_ON_CLOSE) { + SecurityManager security = System.getSecurityManager(); + if (security != null) { + security.checkExit(0); + } + } if (this.defaultCloseOperation != operation) { - if (operation == EXIT_ON_CLOSE) { - SecurityManager security = System.getSecurityManager(); - if (security != null) { - security.checkExit(0); - } - } int oldValue = this.defaultCloseOperation; this.defaultCloseOperation = operation; firePropertyChange("defaultCloseOperation", oldValue, operation);