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

GTK L&F: JTextField ignores its background color

XMLWordPrintable

      FULL PRODUCT VERSION :
      Java(TM) SE Runtime Environment (build 1.6.0-b105)

      ADDITIONAL OS VERSION INFORMATION :
      Ubuntu 7.04(Linux 2.6.20-16-lowlatency)

      A DESCRIPTION OF THE PROBLEM :
      A regression of http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4893567.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile the source code below and see the background color of the second JTextField is not red.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The background color of the second JTextField should be red.
      ACTUAL -
      The background color of the second JTextField should is white.

      REPRODUCIBILITY :
      This bug can be reproduced always.

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

      class Test extends JFrame {
          Test() {
              try {
                  UIManager.setLookAndFeel(
                          "com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
              } catch (Exception e) {
                  e.printStackTrace();
              }
              JTextField textField1, textField2;

              getContentPane().setLayout(new GridLayout(0, 1));
              getContentPane().setPreferredSize(new Dimension(200, 100));
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

              textField1 = new JTextField("WHITE BACKGROUND");
              textField1.setBackground(Color.WHITE);
              getContentPane().add(textField1);

              textField2 = new JTextField("RED BACKGROUND");
              textField2.setBackground(Color.RED);
              getContentPane().add(textField2);

              pack();
              setVisible(true);
          }

          public static void main(String[] args) {
              new Test();
          }
      }
      ---------- END SOURCE ----------

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

            stayer Kirill Kirichenko (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: