--- old/src/java.desktop/windows/classes/sun/awt/windows/WPanelPeer.java 2016-05-11 15:29:58.696290151 +0530 +++ new/src/java.desktop/windows/classes/sun/awt/windows/WPanelPeer.java 2016-05-11 15:29:58.492290151 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,6 +31,14 @@ class WPanelPeer extends WCanvasPeer implements PanelPeer { + // Default background. Gets set on target if + // target has none explicitly specified. + static final Color defaultBackground = SystemColor.control; + + // Default foreground. Gets set on target if + // target has none explicitly specified. + static final Color defaultForeground = SystemColor.windowText; + // ComponentPeer overrides @Override @@ -79,18 +87,15 @@ super.initialize(); insets_ = new Insets(0,0,0,0); - Color c = ((Component)target).getBackground(); - if (c == null) { - c = WColor.getDefaultColor(WColor.WINDOW_BKGND); - ((Component)target).setBackground(c); - setBackground(c); + if (!((Component) target).isBackgroundSet()) { + ((Component) target).setBackground(defaultBackground); + setBackground(defaultBackground); } - c = ((Component)target).getForeground(); - if (c == null) { - c = WColor.getDefaultColor(WColor.WINDOW_TEXT); - ((Component)target).setForeground(c); - setForeground(c); + if (!((Component) target).isForegroundSet()) { + ((Component) target).setForeground(defaultForeground); + setForeground(defaultForeground); } + } /**