JDK-6255775 : Disabled JFormattedTextField and JTextArea show as white in Windows L&F
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2005-04-15
  • Updated: 2011-02-16
  • Resolved: 2006-02-23
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
6Resolved
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.5.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_02-b09)
Java HotSpot(TM) Client VM (build 1.5.0_02-b09, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
4NT  6.01.233U   Windows XP 5.1

A DESCRIPTION OF THE PROBLEM :
When a JTextField is disabled, the background color is set to gray.  This was apparently fixed in response to Bug ID 4883120.  But when a JFormattedTextField or JTextArea is disabled, the background is left as white.  This makes it hard for users to distinguish between enabled and disabled controls.


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.swing.*;

public class Disabled extends JFrame
{
    public static void main(String[] args)
    {
        try
        {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        }
        catch (Throwable t)
        {
             t.printStackTrace();
        }
        Disabled text = new Disabled();
        text.show();
    }

    public Disabled()
    {
        setDefaultCloseOperation(EXIT_ON_CLOSE);

        JTextField text1 = new JTextField("Enabled and Editable JTextField");

        JTextField text2 = new JTextField("Disabled JTextField");
        text2.setEnabled(false);

        JTextField text3 = new JTextField("Uneditable JTextField");
        text3.setEditable(false);

        JTextField text4 = new JTextField("Disabled and Uneditable JTextField");
        text4.setEnabled(false);
        text4.setEditable(false);

        JTextArea area1 = new JTextArea("Enabled and Editable JTextArea");

        JTextArea area2 = new JTextArea("Disabled JTextArea");
        area2.setEnabled(false);

        JTextArea area3 = new JTextArea("Uneditable JTextArea");
        area3.setEditable(false);

        JTextArea area4 = new JTextArea("Disabled and Uneditable JTextArea");
        area4.setEnabled(false);
        area4.setEditable(false);

        JFormattedTextField form1 = new JFormattedTextField("Enabled and Editable JFormattedTextField");

        JFormattedTextField form2 = new JFormattedTextField("Disabled JFormattedTextField");
        form2.setEnabled(false);

        JFormattedTextField form3 = new JFormattedTextField("Uneditable JFormattedTextField");
        form3.setEditable(false);

        JFormattedTextField form4 = new JFormattedTextField("Disabled and Uneditable JFormattedTextField");
        form4.setEnabled(false);
        form4.setEditable(false);

        Box b = new Box(BoxLayout.Y_AXIS);
        b.add(Box.createVerticalStrut(10));
        b.add(text1);
        b.add(Box.createVerticalStrut(10));
        b.add(text2);
        b.add(Box.createVerticalStrut(10));
        b.add(text3);
        b.add(Box.createVerticalStrut(10));
        b.add(text4);
        b.add(Box.createVerticalStrut(10));
        b.add(area1);
        b.add(Box.createVerticalStrut(10));
        b.add(area2);
        b.add(Box.createVerticalStrut(10));
        b.add(area3);
        b.add(Box.createVerticalStrut(10));
        b.add(area4);
        b.add(Box.createVerticalStrut(10));
        b.add(form1);
        b.add(Box.createVerticalStrut(10));
        b.add(form2);
        b.add(Box.createVerticalStrut(10));
        b.add(form3);
        b.add(Box.createVerticalStrut(10));
        b.add(form4);
        b.add(Box.createVerticalStrut(10));

        getContentPane().add("Center", b);
        pack();
    }
}

---------- END SOURCE ----------
###@###.### 2005-04-15 06:28:44 GMT

Comments
EVALUATION JFormattedTextField should match JTextField L&F. ###@###.### 2005-04-18 22:32:45 GMT
18-04-2005