JDK-8282171 : JComboBox too small under Windows LAF
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 19
  • Priority: P4
  • Status: New
  • Resolution: Unresolved
  • OS: windows
  • CPU: x86_64
  • Submitted: 2022-02-17
  • Updated: 2022-03-25
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 19
19Unresolved
Related Reports
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
Java version (OpenJDK):
openjdk version "17" 2021-09-14 / OpenJDK Runtime Environment Temurin-17+35 (build 17+35) / OpenJDK 64-Bit Server VM Temurin-17+35 (build 17+35, mixed mode, sharing)
Java version (Oracle):
openjdk version "19-ea" 2022-09-20 / OpenJDK Runtime Environment (build 19-ea+9-500) / OpenJDK 64-Bit Server VM (build 19-ea+9-500, mixed mode, sharing)

OS:
Edition	Windows 11 Pro
Version	21H2
Installed on	‎06/‎10/‎2021
OS build	22000.527
Experience	Windows Feature Experience Pack 1000.22000.527.0


A DESCRIPTION OF THE PROBLEM :
When not expanded, the text in a non-editable JComboBox gets truncated with ellipses when using the System LAF under Windows 11 and with a display scale of 125%.
The default LAF is OK and if the scale is 100% this is also OK.
Observed in Java 17 (termurin) and confirmed still present on Oracle Java 19 ea.
The appearance is similar to JDK-8179027 which was fixed in JDK 9 and the sample program given in that report still reproduces the problem now.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run the code below under Windows 11 and with graphics scaling of 125%. This code was copied verbatim from JDK-8179027 (https://bugs.openjdk.java.net/browse/JDK-8179027)

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The middle combo box should be wide enough to display the text. Note the right-hand box is OK because this is set editable.
ACTUAL -
The text is truncated with ellipses. The effect is similar to that reported in JDK-8179027 as https://bugs.openjdk.java.net/secure/attachment/67764/9eab166.PNG

---------- 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 ----------

FREQUENCY : always



Comments
Additional information from submitter: =========================== attached screenshots from submitter "scaling_100.png" "scaling_125.png" "scaling_150.png" "Scaling_175.png"
23-02-2022

Checked with attached Testcase in Windows 10, Issue is not observed at display scale 125% and 100%<attached Screenshot> Test Result: ========== 8u321: Pass 11.0.14: Pass 17: Pass 18ea36: Pass 19ea9: Pass To be Viewed in Windows 11
21-02-2022