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

JComboBox hides end of text when height > default

XMLWordPrintable

      FULL PRODUCT VERSION :
      1.6.0_01
      also 1.4.2_14

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP pro SP2

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      using Windows XP desktop theme

      A DESCRIPTION OF THE PROBLEM :
      JCombobBox paints an extra space to the left of the button which hides the end of the selection in the editor. The problem occurs when a larger font is used to cause the component to be higher that the default font. It also happens if a size is set using setPreferredSize or setSize which is taller regardless of the font.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Occurs with or without a layout manager on a panel.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Should see the entire selection and be able to type up to the arrow.
      ACTUAL -
      See all but the last bit, and typing stops short of the arrow.
      (see attachment scrshot1.jpg & scrshot2.jpg)

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      No errors.

      REPRODUCIBILITY :
      This bug can be reproduced always.

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

      /**
       *
       * @author Steve
       */
      public class ComboTest {

      static public void main(String[] args) {
      try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
      }
      catch (Exception e) {
      e.printStackTrace();
      System.exit(0);
      }
      JFrame f = new JFrame();
      f.setDefaultCloseOperation(f.EXIT_ON_CLOSE);
      JComboBox c = new JComboBox(new String[]{"TEST 1", "TEST 2"});
      c.setPreferredSize(new Dimension(60, 30));
      //c.setFont(c.getFont().deriveFont(18f));
      c.setEditable(true);
      c.setPrototypeDisplayValue("TEST 1");
      JPanel p = new JPanel();
      p.add(c);
      f.getContentPane().add(p);
      f.setSize(200, 200);
      f.setVisible(true);
      }

      }

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

            dnguyen Damon Nguyen
            ryeung Roger Yeung (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: