FULL PRODUCT VERSION :
java version "1.6.0-beta2"
Java(TM) SE Runtime Environment (build 1.6.0-beta2-b81)
Java HotSpot(TM) Client VM (build 1.6.0-beta2-b81, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
Firstly the background color of a JToolBar under the Windows XP Look&Feel is different from that in previous versions of Java (it's no longer the same color as JPanel). The background seems to be painted in such a way that it cannot be changed. Calling setBacground on a JToolBar instance has no effect neither does setOpaque.
I assume the XP Look&Feel is drawing the background without any regard to changes requested by calls to setBackground or setOpaque.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a JToolBar and try to change it's background color under the Windows XP look and feel, either by calling setBackground or setOpaque
EXPECTED VERSUS ACTUAL BEHAVIOR :
The background should change color. For instance calling setBackground(Color.RED) should result in the background of the toolbar being red.
There is no visible change to the toolbar when using the Windows XP look and feel (under Metal it does change which I assume suggests that this is an XP look and feel issue rather than an issue with JToolBar specifically)
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class Test extends JFrame
public static void main(String args) throws Exception
Test t = new Test();
JPanel panel = new JPanel(new BorderLayout());
JToolBar toolbar1 = new JToolBar();
toolbar1.add(new JButton("Button 1"));
toolbar1.add(new JButton("Button 2"));
JToolBar toolbar2 = new JToolBar();
toolbar2.add(new JButton("Button A"));
toolbar2.add(new JButton("Button B"));
panel.add(new JLabel("<html><body>Top toolbar should be red as background was set to <code>Color.RED</code><br><br>The bottom toolbar should be green as </code>setOpaque(false)</code> was called on the toolbar and the underlying <code>JPanel</code> has a background of <code>Color.GREEN</code>.</body></html>"),BorderLayout.CENTER);
---------- END SOURCE ----------
Release Regression From : 5.0u6
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.