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

[macos11] Check mark of System Screen Menubar is not visible when the language set other than English

    XMLWordPrintable

    Details

      Description

      ADDITIONAL SYSTEM INFORMATION :
      macOS Big Sur 11.2.3
      OpenJDK 15.0.2
      JavaFX 16

      A DESCRIPTION OF THE PROBLEM :
      When using system screen menubar on macOS and set the language of macOS other than English, for example to German, then the selection mark of the checkbox menu item is not visible anymore.

      It happens using Swing JMenuBar and also using JavaFX MenuBar.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Use macOS Big Sur and set macOS system language to other than English, for example to German.
      Open Terminal:
      Start the appended sample program from terminal
      java ScreenMenuBarCheckboxBugSwing
      java -p javafx-sdk-16/lib --add-modules javafx.controls ScreenMenuBarCheckboxBugJavaFX

      Click on "Menu" -> checkmark is missing before "CheckBoxMenuItem" but you can see the empty big gap, indicating that the checkmark should be there

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The selection mark of a checkbox menu item should be visible in all languages of macOS, for example German.
      ACTUAL -
      The selection mark of a checkbox menu item is only visible in macOS with the language set to English.

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

      import javax.swing.JCheckBoxMenuItem;
      import javax.swing.JFrame;
      import javax.swing.JMenu;
      import javax.swing.JMenuBar;
      import javax.swing.WindowConstants;

      public class ScreenMenuBarCheckboxBugSwing {

          //start this class from terminal (when you start this class from IntelliJ, you will not run in this issue)
          public static void main(String[] args) {
              System.setProperty("apple.laf.useScreenMenuBar", "true");
              ScreenMenuBarCheckboxBugSwing app = new ScreenMenuBarCheckboxBugSwing();
              app.show();
          }

          public void show() {
              JFrame frm = new JFrame();
              JMenuBar menuBar = new JMenuBar();
              JMenu menu = new JMenu("Menu");
              //macOS BigSur 11.2.3 with os language to german, selection mark is missing
              JCheckBoxMenuItem checkBoxMenuItem = new JCheckBoxMenuItem("CheckBoxMenuItem");
              checkBoxMenuItem.setSelected(true);
              menu.add(checkBoxMenuItem);
              menuBar.add(menu);
              frm.setJMenuBar(menuBar);
              frm.setSize(new Dimension(200, 400));
              frm.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
              frm.setVisible(true);
          }
      }


      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.CheckMenuItem;
      import javafx.scene.control.Menu;
      import javafx.scene.control.MenuBar;
      import javafx.stage.Stage;

      public class ScreenMenuBarCheckboxBugJavaFX extends Application {

          //start this class from terminal (when you start this class from IntelliJ, you will not run in this issue)
          public static void main(String[] args) {
              launch(args);
          }

          @Override
          public void start(Stage stage) throws Exception {
              MenuBar menuBar = new MenuBar();
              Menu menu = new Menu("Menu");
              //macOS BigSur 11.2.3 with os language to german, selection mark is missing
              CheckMenuItem checkMenuItem = new CheckMenuItem("CheckMenuItem");
              checkMenuItem.setSelected(true);
              menu.getItems().add(checkMenuItem);
              menuBar.getMenus().add(menu);
              menuBar.setUseSystemMenuBar(true);
              Scene scene = new Scene(menuBar, 200, 400);
              stage.setScene(scene);
              stage.show();
          }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      No workaround is known. Setting the macOS language for German users to English is a not accepted workaround for our customers.

      FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

              Assignee:
              trebari Tejpal Rebari
              Reporter:
              webbuggrp Webbug Group
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated: