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

Regression: JComboBox has wrong width under WindowsXP L&F

XMLWordPrintable

    • b103
    • x86
    • windows_xp

        FULL PRODUCT VERSION :
        java version "1.6.0-rc"
        java(TM) SE Runtime Environment (build 1.6.0-rc-b99)
        Java HotSpot(TM) Client VM (build 1.6.0-rc-b99, mixed mode, sharing)

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

        A DESCRIPTION OF THE PROBLEM :
        The width of a JComboBox is too narrow under WindowsXP Look&Feel. This results in truncated text (trailing characters are replaced by "...") when the widest combo box item is displayed.



        REGRESSION. Last worked in version mustang

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Run the test case and take a look at the text displayed in the JComboBox.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        The text "mm" should be displayed on the JComboBox
        ACTUAL -
        The text "..." is displayed.

        REPRODUCIBILITY :
        This bug can be reproduced always.

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

        /**
         * Test to visualize a bug in JDK6-b99 on Windows XP
         * Displays a JComboBox and a JLabel in a JFrame. The label only has the purpose of making sure that the combo
         * box only occupies as much space as it requires.
         * On JDK6-b99 you will see that the combo box will display "..." instead of "mm".
         */
        public class ComboBoxTest {

          public static void main(String[] args) {
            // set windows xp look and feel (on Windows XP platform)
            try {
              UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            } catch (Exception ex) {
              ex.printStackTrace();
            }
            // create and display frame
            JFrame jFrame = new JFrame("JComboBox Test");
            jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            jFrame.setLayout(new BorderLayout());
            jFrame.add(new JComboBox(new Object[]{"mm", "cm"}), BorderLayout.WEST);
            jFrame.add(new JLabel("<------fill----->"), BorderLayout.CENTER);
            jFrame.pack();
            jFrame.setLocationRelativeTo(null);
            jFrame.setVisible(true);
          }
        }
        ---------- END SOURCE ----------

        Release Regression From : 1.5
        The above release value was the last known release where this
        bug was not reproducible. Since then there has been a regression.
        http://forums.java.net/jive/thread.jspa?threadID=18752&tstart=0

              jmarinacsunw Joshua Marinacci (Inactive)
              idk Igor Kushnirskiy (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: