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

[macos 10.15] System menu bar does not work initially on macOS Catalina

XMLWordPrintable

        ADDITIONAL SYSTEM INFORMATION :
        Java (also happens with versions 11 and 12 in OpenJDK, AdoptJDK and Zulu):
        openjdk version "13.0.1" 2019-10-15
        OpenJDK Runtime Environment Zulu13.28+11-CA (build 13.0.1+10-MTS)
        OpenJDK 64-Bit Server VM Zulu13.28+11-CA (build 13.0.1+10-MTS, mixed mode, sharing)

        OSX:
          System Version: macOS 10.15.1 (19B88)
          Kernel Version: Darwin 19.0.0
          Boot Volume: Macintosh HD
          Boot Mode: Normal
          Computer Name: #####
          Username: #####
          Secure Virtual Memory: Enabled
          System Integrity Protection: Enabled
          Time since boot: 14:48


        A DESCRIPTION OF THE PROBLEM :
        On OSX Catalina, the global menubar of JavaFX applications is unresponsive upon program start. It works correctly after switching to another application and back again. This does not happen on earlier versions of OSX. Verified in Java 11, 12 and 13.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
         1. compile and run a JavaFX application using a menubar with useSystemMenu(true)
         2. click on menuitems in the menubar
         3. switch to any other application
         4. switch back to the JavaFX application
         5. click on menuitems in the menubar


        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        It should be possible to select menuitems in steps 2 and 5.
        ACTUAL -
        The menu is shown but does not response to mouse and keyboard events in step 2. step 5 works as expected.

        ---------- BEGIN SOURCE ----------
        package hellofx;

        import javafx.application.Application;
        import javafx.scene.Scene;
        import javafx.scene.control.Label;
        import javafx.scene.control.Menu;
        import javafx.scene.control.MenuBar;
        import javafx.scene.layout.StackPane;
        import javafx.scene.layout.VBox;
        import javafx.stage.Stage;

        public class HelloFX extends Application {

            @Override
            public void start(Stage stage) {
                String javaVersion = System.getProperty("java.version");
                String javafxVersion = System.getProperty("javafx.version");
                Label l = new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + ".");
                MenuBar menuBar = new MenuBar(new Menu("TEST"));
                menuBar.setUseSystemMenuBar(true);
                Scene scene = new Scene(new VBox(menuBar, new StackPane(l)), 640, 480);
                stage.setScene(scene);
                stage.show();
            }

            public static void main(String[] args) {
                launch();
            }

        }

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

        FREQUENCY : always


              kcr Kevin Rushforth
              webbuggrp Webbug Group
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: