-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
macOS System Menu Bar Support #107
Comments
This issue is not related to the plugin but to the Java module system. NSMenuFX uses an internal package from the javafx.graphics module and the current version of the plugin always adds the JavaFX jars to the modulepath. Next version should include an option to use only the classpath, so problems like this could be avoided (if you don't need to use the modulepath) You can fix this by using
|
The |
First off, thanks for the right module configuration tip. I did a bit more research, and found the built-in JavaFX MenuBar.setUseSystemMenuBar(). On macOS Catalina with JavaFX, the menubar is completely unresponsive when MenuBar.setUseSystemMenuBar(true) when the application first launches. I just was going to record the behavior when I discovered that switching to another application and then back again makes the system menubar work again. It looks like there is some confusion about how to get menus working nicely on macOS. I just updated this issue title to reflect the goal, as opposed to a particular solution - I'd like to be able to at least minimally support the macOS native menu bar. To summarize:
This might be as simple as documenting the correct API usage (possibly with a workaround for the focus issue). Let me know if you have any additional questions or if there is anything else I can do to help. |
I think this is a JavaFX issue and, unlike the other one, this can not be fixed by using any configuration trick. I suggest you report it in JavaFX repository. |
I did submit a bug via the JBS. Not a particularly user friendly system. Got a ticket number, but no way to add anything to it, update, etc. :\ For some of these issues, it looks like there is an elaborate choreography for a workaround. For example, I found this: ... for sorting out system tray icon / menu stuff with JavaFX. I was kind of hoping that "put a working menu in the system menu on macOS" was supported. |
If you mean this part?
This is due to the following bug: JDK-8233678: [macos 10.15] System menu bar does not work initially on macOS Catalina |
Yup. That's it. Can't follow links for fixes, did you submit a fix for openjfx16 or is that just a defer? |
I had hoped to get it in for openjfx15, but it missed that. It's on the list of fixes planned for openjfx16, but isn't done yet. |
Closing as this is a JavaFX issue. |
Trying to add support for NSMenuFX in a Hello World JavaFX Maven project.
Lots of errors related to modules / access. Here is the trail for the issue on the NSMenuFX page:
codecentric/NSMenuFX#29
That issue should have enough for repro steps, but the short version:
This is both a really nice module (for native macOS menu integration) and also a nice test case for working with/around the Java module system.
Here is sample of the error output. Let me know if you need any additional information.
[INFO] --- javafx-maven-plugin:0.0.4:run (default-cli) @ hellofx --- Exception in Application start method java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:464) at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1071) Caused by: java.lang.RuntimeException: Exception in Application start method at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900) at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195) at java.base/java.lang.Thread.run(Thread.java:832) Caused by: java.lang.IllegalAccessError: class de.codecentric.centerdevice.glass.AdapterContext (in unnamed module @0x797d0761) cannot access class com.sun.javafx.tk.Toolkit (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.tk to unnamed module @0x797d0761 at de.codecentric.centerdevice.glass.AdapterContext.createContext(AdapterContext.java:34) at de.codecentric.centerdevice.glass.AdapterContext.getContext(AdapterContext.java:19) at de.codecentric.centerdevice.MenuToolkit.toolkit(MenuToolkit.java:57) at de.codecentric.centerdevice.MenuToolkit.toolkit(MenuToolkit.java:53) at de.codecentric.centerdevice.MenuToolkit.toolkit(MenuToolkit.java:49) at sample.Main.start(Main.java:52) at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846) at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455) at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428) at java.base/java.security.AccessController.doPrivileged(AccessController.java:391) at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427) at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96) Exception running application sample.Main
The text was updated successfully, but these errors were encountered: