United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6463915 : REGRESSION: JRadioButton and JCheckBox have wrong disabled foreground under WinXP Look&Feel

Details
Type:
Bug
Submit Date:
2006-08-25
Status:
Resolved
Updated Date:
2011-02-16
Project Name:
JDK
Resolved Date:
2006-09-14
Component:
client-libs
OS:
windows_xp
Sub-Component:
javax.swing
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:

Related Reports
Relates:

Sub Tasks

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]
                                     
2006-12-18
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.
                                     
2006-09-07
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.
                                     
2006-09-01



Hardware and Software, Engineered to Work Together