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

REGRESSION: JComboBox default width is to narrow

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: 5.0
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:

      Description



      Name: sh120115 Date: 01/15/2004


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

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

      A DESCRIPTION OF THE PROBLEM :
      The default size size of the JComboBox is now defaults to a slightly too narrow width, depending on the string displayed. Perhaps as a result of the different font used in Tiger compared with previous releases.

      This results in some selections being cut off with an ellipsis displayed at the end of the String. In some cases this could make the selections impossible to distinguish.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the provided same code

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The widest string should determine the width of the JComboBox so that no text is cut off.
      ACTUAL -
      The end of the text is cut off for the widest strings

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.BorderLayout;

      import javax.swing.JComboBox;
      import javax.swing.JFrame;
      import javax.swing.UIManager;
      import javax.swing.UnsupportedLookAndFeelException;

      /* ComboWidth.java
       * Created on 9-Jan-2004
       *
       */

      /**
       * @author scott.palmer
       */
      public class ComboWidth extends JFrame
      {

          public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException
          {
              UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
              ComboWidth cw = new ComboWidth();
              cw.pack();
              cw.setVisible(true);
          }
          
          private ComboWidth()
          {
              super("Width");
              JComboBox cb = new JComboBox( new String [] {
                      "Normal Mode", "This is Concurrent Mode A", "This is Concurrent Mode B"} );
              cb.setSelectedIndex(1);
              getContentPane().add(cb, BorderLayout.NORTH);
              setDefaultCloseOperation(EXIT_ON_CLOSE);
          }
      }

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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              kizune Alexander Zuev
              Reporter:
              shickeysunw Shannon Hickey (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: