JDK-6463915 : REGRESSION: JRadioButton and JCheckBox have wrong disabled foreground under WinXP Look&Feel
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2006-08-25
  • Updated: 2011-02-16
  • Resolved: 2006-09-14
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
6 b99Fixed
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.6.0-rc"
Java(TM) SE Runtime Environment (build 1.6.0-rc-b97)
Java HotSpot(TM) Client VM (build 1.6.0-rc-b97, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
When using the Windows XP Look&Feel, the text of disabled JRadioButtons and JCheckBoxes is displayed in black, while it should be displayed in grey. As a result the user can only tell from the icon if a component is enabled or not. Also this is inconsistent with the native Windows XP look and feel, which also paints text of disabled radio buttons and check boxes in grey color.

A picture would say more than a million words, but unfortunately it is not possible to attachm images to bug reports.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Start the test case on Windows XP. With JDK 1.6 the text of the buttons is black, while with JDK 1.5 the text is black.



EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The text on the buttons should be grey
ACTUAL -
The text is black

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------

import javax.swing.*;
import java.awt.*;

public class Test {

  public static void main(String[] args) {
    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception ex) {
      ex.printStackTrace();
    }

    JFrame frame = new JFrame("Test");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(new GridLayout(0, 1));
    JRadioButton jRadioButton = new JRadioButton("Disabled");
    jRadioButton.setEnabled(false);
    frame.add(jRadioButton);
    JCheckBox jCheckBox = new JCheckBox("Disabled");
    jCheckBox.setEnabled(false);
    frame.add(jCheckBox);

    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
  }

}
---------- END SOURCE ----------

Release Regression From : 5.0u8
The above release value was the last known release where this 
bug was not reproducible. Since then there has been a regression.

Comments
EVALUATION this bug is a regression introduced by the fix for 6390630 [WinLAF: JButtons on XP have text with wrong color / missing shadow using certain 3rd party themes]
18-12-2006

EVALUATION Text for JRadioButton and JCheckBox for Windows L&F is painted in WindowsGraphicsUtils.paintXPText. To get the current text color correct PART and STATE should be used. While the PART used for JRadioButton and JCheckBox is correct the STATE is wrong. The STATE comes from WindowsButtonUI.getXPButtonState(b). This method handles JRadioButton and JCheckBox as if they are JButton and thus returns the wrong STATE. Suggested fix: customize WindowsButtonUI.getXPButtonState(b) for JRadioButton and JCheckBox.
07-09-2006

EVALUATION I can confirm this bug appears in 6.0 b97. It does *not* appear in 5.0u1. It does *not* appear in 5.0u8.
01-09-2006