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

REGRESSION: non-editable JTextField background color becomes fixed in Win L&F

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 5.0
    • client-libs



      Name: gm110360 Date: 02/27/2004


      FULL PRODUCT VERSION :
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b32c)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b32c, mixed mode)

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

      A DESCRIPTION OF THE PROBLEM :
      If a JTextField that is not editable exists under the Windows L&F,
      the background color of the JTextField will not change as it should
      if the L&F is changed . The Windows Classic L&F does not have
      this problem.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      run code

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Expect both JTextFields to have the same background color.
      ACTUAL -
      The JTextField that was created under the Windows L&F retains
      the Windows L&F background color, even though updateUI() was
      called.

      REPRODUCIBILITY :
      This bug can be reproduced always.

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

          public class JTextFieldBug {
         
             public static void main(String args[]) {
               try {
                  UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); }
                   catch(Exception e) {}
            
               JDialog dialog = new JDialog();
               dialog.getContentPane().setLayout(new BoxLayout(dialog.getContentPane(), BoxLayout.X_AXIS));
               JTextField tf = new JTextField("test");
               tf.setEditable(false);
               dialog.getContentPane().add(tf);
               dialog.setVisible(true);
            
               try {
                  UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel"); }
                   catch(Exception e) {}
               tf.updateUI();
                   
               tf = new JTextField("test2");
               tf.setEditable(false);
               dialog.getContentPane().add(tf);
               dialog.pack();
            }
         
         }


      ---------- END SOURCE ----------

      Release Regression From : 1.4.2
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.

      (Incident Review ID: 240589)
      ======================================================================

            naasunw Naa Naa (Inactive)
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: