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

XP L&F: Disabled editable JComboBox doesn't draw correctly in WinXP laf

    XMLWordPrintable

    Details

      Description

      Name: rmT116609 Date: 03/31/2004


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

      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 :
      When you disable a JComboBox that is editable and set its preferred sized to be larger, You can see a white strip drawn (incorrectly) to the left of the drop down arrow. If you compare with other look-and-feels, you can see that in Win XP LAF the arrow is narrower, and the white strip is where the arrow occupies in other LAFs.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the sample code provided in Windows XP, using the Windows XP windowing style.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      No white strip to the left of the drop down arrow.
      ACTUAL -
      There is a white strip to the left of the drop down arrow.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.BorderLayout;
      import java.awt.Dimension;
      import java.awt.event.ActionEvent;
      import java.awt.event.ActionListener;

      import javax.swing.JButton;
      import javax.swing.JComboBox;
      import javax.swing.JFrame;
      import javax.swing.JPanel;
      import javax.swing.UIManager;

      public class TestApp implements ActionListener
      {
      JFrame frame = null;
      private JComboBox cb;

      public TestApp()
      {
      try
      {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
      }
      catch (Exception e)
      {
      e.printStackTrace();
      }

      JFrame frame = new JFrame();
      frame.setTitle(System.getProperty("java.version"));
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

      JPanel actionPanel = createActionPanel();
      frame.getContentPane().add(actionPanel, BorderLayout.CENTER);

      frame.pack();
      frame.setVisible(true);
      }


      public static void main(String[] args)
      {
      new TestApp();
      }

      public JPanel createActionPanel()
      {
      JPanel actionPanel = new JPanel();

      JButton actionButton = new JButton("Toggle Combo Box");
      actionButton.setActionCommand("ACTION");

      this.cb = new JComboBox();
      cb.setPreferredSize(new Dimension(100, 50));

      cb.addItem("Test");

      cb.setEditable(true);
      cb.setEnabled(false);

      actionButton.addActionListener(this);


      actionPanel.add(actionButton);
      actionPanel.add(cb);

      return actionPanel;
      }

      public void actionPerformed(ActionEvent e)
      {
      if (e.getActionCommand().equals("ACTION"))
      {
      this.cb.setEnabled(!this.cb.isEnabled());
      }
      }

      }
      ---------- END SOURCE ----------
      (Incident Review ID: 245814)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              rupashka Pavel Porvatov (Inactive)
              Reporter:
              rmandalasunw Ranjith Mandala (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: