--- old/src/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java 2014-04-24 13:04:57.278397100 +0400 +++ new/src/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java 2014-04-24 13:04:56.692322600 +0400 @@ -44,6 +44,7 @@ import java.awt.image.*; import java.security.AccessController; import java.util.*; +import java.util.concurrent.atomic.AtomicBoolean; import javax.swing.*; import javax.swing.border.*; @@ -52,6 +53,7 @@ import sun.awt.image.SunWritableRaster; import sun.awt.windows.ThemeReader; +import sun.awt.windows.WToolkit; import sun.security.action.GetPropertyAction; import sun.swing.CachedPainter; @@ -72,6 +74,8 @@ private static Boolean themeActive = null; + private static final AtomicBoolean xpstyleEnabled = WToolkit.getWToolkit().getXPStyleEnabled(); + private HashMap borderMap; private HashMap colorMap; @@ -96,13 +100,12 @@ * are not active or if this is not Windows XP */ static synchronized XPStyle getXP() { + if (themeActive != null && themeActive.booleanValue() != xpstyleEnabled.get()) { + // JDK-8039383: theme changed, schedule updateAllUIs() + DesktopProperty.scheduleUpdateUI(); + } if (themeActive == null) { - Toolkit toolkit = Toolkit.getDefaultToolkit(); - themeActive = - (Boolean)toolkit.getDesktopProperty("win.xpstyle.themeActive"); - if (themeActive == null) { - themeActive = Boolean.FALSE; - } + themeActive = Boolean.valueOf(xpstyleEnabled.get()); if (themeActive.booleanValue()) { GetPropertyAction propertyAction = new GetPropertyAction("swing.noxp");