JDK-8310641 : MenuItems overlap because of missing height 4K scaling
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 11,20,21,22
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows
  • CPU: x86_64
  • Submitted: 2023-06-21
  • Updated: 2023-08-25
  • Resolved: 2023-08-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.
Other
tbdResolved
Related Reports
Duplicate :  
Description
ADDITIONAL SYSTEM INFORMATION :
Windows 11
OpenJdk 20.0.1
Display Resolution: 3840x2160
Display Scaling: 250% (Recommended)

A DESCRIPTION OF THE PROBLEM :
When adding a java.awt.MenuBar to a JFrame, the height of the MenuItems does not scale with the rest of the window. As the text of the MenuItems retains the normal size, the MenuItems overlap.

This behaviour is present in many popular libraries and applications. One example is ImageJ/Fiji, which has hundreds of different MenuItems as main user input. Bugs like this give an application an unprofessional appearance.


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

public class Main {
    public static void main(String[] args) {

        JFrame frame = new JFrame("Some Frame");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(400, 400);
        MenuBar menuBar = new MenuBar();
        Menu menu = new Menu("File");
        menuBar.add(menu);
        MenuItem menuItem1 = new MenuItem("Open");
        MenuItem menuItem2 = new MenuItem("Save as");
        menu.add(menuItem1);
        menu.add(menuItem2);

        frame.setMenuBar(menuBar);
        frame.setVisible(true);

    }
}
---------- END SOURCE ----------

FREQUENCY : always



Comments
Duplicate of JDK-8259913.
25-08-2023

Well, JDK-8259913 was reported in 2021, this one was reported two months ago. We already know the root cause is the same. We should close *this bug* as duplicate of the older one.
25-08-2023

JDK-8259913 or JDK-8310641 - one of these JBS issues will be closed as duplicate once work is in progress.
23-08-2023

I believe this the duplicate of JDK-8259913.
22-08-2023

Looks to be similar to linked issue JDK-8259913.
22-06-2023

Replicable on mainline. Screenshot attached.
22-06-2023

Moving to JDK Project for triage with higher screen resolution(4K) monitor.
22-06-2023