JDK-5004920 : REGRESSION: non-editable JTextField background color becomes fixed in Win 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: 2004-02-27
  • Updated: 2004-03-01
  • Resolved: 2004-03-01
Related Reports
Duplicate :  
Description

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) 
======================================================================

Comments
EVALUATION Name: sh120115 Date: 02/27/2004 ###@###.###, this looks similar to 4991597. Could it be a duplicate? ====================================================================== Name: anR10225 Date: 03/01/2004 The reason is the same as for bug 4991597. The value returned by the XPStyle.getColor() isn't an instance of UIResource. Close this bug as duplicate. ======================================================================
11-06-2004