JDK-6626715 : Nimbus L&F: JCheckBoxes don't honor setBackground()
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6u5
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2007-11-06
  • Updated: 2011-02-16
  • Resolved: 2007-12-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6u10Resolved
Related Reports
Duplicate :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.6.0_05-ea"
Java(TM) SE Runtime Environment (build 1.6.0_05-ea-b04)
Java HotSpot(TM) Client VM (build 1.6.0_05-ea-b04, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Windows XP

A DESCRIPTION OF THE PROBLEM :
In Nimbus, if you try to set a different background color using setBackground(), it is ignored.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Add a JCheckBox to a frame and set its background color to anything other than the standard (for example, checkbox.setBackground(new java.awt.Color(255, 255, 153)). Under Nimbus, this new background color will not be used. The background color of the container of the checkbox will be used instead.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Having the checkbox displayed with the background color passed in setBackground().
ACTUAL -
The checkbox is displayed with the background color of its container.

REPRODUCIBILITY :
This bug can be reproduced always.

Comments
EVALUATION Most Nimbus components have complex graphics that can not be represented by a single backgound color. This is true for JCheckBoxes as they have complex graphics in the icon. The color behind the icon and text is not the backgound as it is really part of the parent container. So Nimbus combonents have been made non-opaque so the can have transparent backgound. This was done in bug 6636230 which fixes this issue.
07-12-2007

EVALUATION This bug is fixed as part of bug 6604357. It is currently in review.
13-11-2007