Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6255775

Disabled JFormattedTextField and JTextArea show as white in Windows L&F

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: 5.0
    • Fix Version/s: 6
    • Component/s: client-libs

      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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              rbair Richard Bair (Inactive)
              Reporter:
              jssunw Jitender S (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: