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

REGRESSION: Background of disabled->enabled editable JComboBox is incorrect under Motif L&F

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b80
    • CPU:
      sparc
    • OS:
      solaris_9, solaris_10

      Description

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

      ADDITIONAL OS VERSION INFORMATION :
      SunOS aleut 5.9 Generic_112233-07 sun4u sparc SUNW,Ultra-5_10
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      In JDK 1.5_05, the background of an editable JComboBox is white only if the JComboBox is always enabled. Once the JComboBox is disabled, the background becomes gray. It does not go back to white if it is reenabled.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the attached program.
      Note the background of the two JComboBoxes.
      Click the Enable button. Note the backgrounds.
      Click the Disable button. Note the backgrounds.


      REPRODUCIBILITY :
      This bug can be reproduced always.

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

      /**
       * This program illustrates a defect in the handling of the background of an
       * editable JComboBox under JDK 1.5.0_05 using the Motif L&F.
       * <p>
       * In JDK 1.4.2, the background of an enabled editable JComboBox is white.
       * <p>
       * In JDK 1.5_05, the background is white only if the JComboBox is always
       * enabled. Once the JComboBox is disabled, the background becomes gray.
       * It does not go back to white if it is reenabled.
       */
      public class JComboBoxBackground extends JPanel
      {
        JButton enableButton = new JButton ("Enable");
        JButton disableButton = new JButton ("Disable");
        JComboBox box1 = new JComboBox (new String[] {"Initially enabled"});
        JComboBox box2 = new JComboBox(new String[] {"Initially disabled"});

        public JComboBoxBackground()
        {
          box1.setEditable (true);
          box2.setEditable (true);
          box2.setEnabled (false);

          setLayout (new BorderLayout());
          add (enableButton, BorderLayout.WEST);
          add (disableButton, BorderLayout.EAST);
          add (box1, BorderLayout.NORTH);
          add (box2, BorderLayout.SOUTH);

          enableButton.addActionListener (new ActionListener()
            {
              public void actionPerformed (ActionEvent e)
              {
                box1.setEnabled (true);
                box2.setEnabled (true);
              }
            });

          disableButton.addActionListener (new ActionListener()
            {
              public void actionPerformed (ActionEvent e)
              {
                box1.setEnabled (false);
                box2.setEnabled (false);
              }
            });
        }

        public static void main (String[] args)
        {
          String LAF = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";

          try {
            UIManager.setLookAndFeel (LAF);
          } catch (Exception e) {
            System.err.println (e);
          } // try

          JPanel panel = new JComboBoxBackground();

          JOptionPane.showMessageDialog (null, panel);
        }
      }
      ---------- END SOURCE ----------

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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mlapshin Mikhail Lapshin (Inactive)
              Reporter:
              jssunw Jitender S (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: