JDK-8179027 : JComboBox too small under Windows LAF
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 9
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_7
  • CPU: x86_64
  • Submitted: 2017-04-20
  • Updated: 2022-02-21
  • Resolved: 2017-04-27
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 10 JDK 9
10Fixed 9 b169Fixed
Related Reports
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "9-ea"
Java(TM) SE Runtime Environment (build 9-ea+165)
Java HotSpot(TM) Server VM (build 9-ea+165, mixed mode, emulated-client)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]

A DESCRIPTION OF THE PROBLEM :
Under Windows LAF, JComboBox is too small. The height is smaller than for a native combobox and in the non-editable combobox in the test case, the selected item doesn't fit and is rendered with ellipses.

REGRESSION.  Last worked in version 8u131

ADDITIONAL REGRESSION INFORMATION: 
The JComboBox change in b161 (Changeset: 743970d86b39 Bug ID:6490753) seems to have introduced the problem.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
java ComboBoxLab


REPRODUCIBILITY :
This bug can be reproduced always.

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

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

public class ComboBoxLab extends JFrame
{
   public ComboBoxLab()
   {
      setDefaultCloseOperation( EXIT_ON_CLOSE );

      getContentPane().setLayout( new FlowLayout() );

      getContentPane().add( new JTextField( "item 1" ) );

      JComboBox< String > cboRo = new JComboBox< String >( new String[] { "item 1", "item 2", "item 3" } );
      getContentPane().add( cboRo );

      JComboBox< String > cboRw = new JComboBox< String >( new String[] { "item 1", "item 2", "item 3" } );
      cboRw.setEditable( true );
      getContentPane().add( cboRw );

      pack();
      setVisible( true );
   }

   public static void main( String[] args ) throws Exception
   {
      UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );
      new ComboBoxLab();
   }

}

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


Comments
URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/caf8ee16cea8 User: lana Date: 2017-05-10 19:28:11 +0000
10-05-2017

URL: http://hg.openjdk.java.net/jdk9/client/jdk/rev/caf8ee16cea8 User: ssadetsky Date: 2017-04-27 15:28:43 +0000
27-04-2017

The issue may affect user experience on Windows with System L&F: combo box controls have non-standard size and layout, that results in visual style degrade of the UI and can make it unpresentable. The issue is caused by regression in 9. Combo box Windows XP L&F skins were made looking similar to Windows native combo box appearance, but this affected the control preferred size calculation which is used during container auto-layout. The fix corrects combo box preferred size calculation to make it compatible to the new L&F skins. The risk is minimal since only number constants are slightly corrected depending on the combo box control type if the Windows system L&F is used and the XP styling is on. The fix was reviewed by Phil Race and Alexandr Scherbatiy. webrev: http://cr.openjdk.java.net/~ssadetsky/8179027/webrev.00/
26-04-2017

This seems a regression introduced in 9 ea b161 from the fix integrated with JDK-6490753. To verify, run the attached test case (ComboBoxLab.java). See attached screenshots depicting the change. Results: ======== 9 ea b160: OK 9 ea b161: FAIL 9 ea b166: FAIL
20-04-2017