--- old/src/java.desktop/share/classes/java/awt/Window.java 2015-09-25 14:26:34.526895100 +0300 +++ new/src/java.desktop/share/classes/java/awt/Window.java 2015-09-25 14:26:34.054895100 +0300 @@ -52,7 +52,6 @@ import sun.awt.AWTAccessor; import sun.awt.AWTPermissions; import sun.awt.AppContext; -import sun.awt.CausedFocusEvent; import sun.awt.DebugSettings; import sun.awt.SunToolkit; import sun.awt.util.IdentityArrayList; @@ -222,7 +221,7 @@ private transient Component temporaryLostComponent; static boolean systemSyncLWRequests = false; - boolean syncLWRequests = false; + volatile boolean syncLWRequests = false; transient boolean beforeFirstShow = true; private transient boolean disposing = false; transient WindowDisposerRecord disposerRecord = null; @@ -4129,6 +4128,32 @@ @Override void updateZOrder() {} + /** + * Enables the synchronous focus requests on lightweight components in this window + * if {@code true} is specified and the system property + * {@code awt.enableSyncLWFocus} is set. Reverts to the asynchronous focus requests + * if the specified value is {@code false}. + * By default, all windows use asynchronous lightweight focus requests. + * + * The synchronous lightweight focus requests should only enabled + * if this window will never transfer focus to other heavyweight containers. + * In this case the observable focus behavior is the same as with + * asynchronous requests. + * + * If the window does transfer focus to other + * heavyweight containers and the synchronous lightweight focus requests + * are enabled to it then further focus behavior is unspecified. + * + * @param enable whether to enable the lightweight focus requests + * + * @see java.awt.Component#isLightweight + * @since 1.9 + */ + public void setSyncLWFocus(boolean enable) { + syncLWRequests = enable && java.security.AccessController.doPrivileged( + new GetPropertyAction("awt.enableSyncLWFocus")) != null; + } + } // class Window