简体   繁体   English

在Mac上最小化窗口时,JavaFX系统MenuBar消失

[英]JavaFX system MenuBar disappears when the window is being minimized on Mac

I'd like to create a JavaFX application with MenuBar and I want my application to look more native-like, so I set useSystemMenuBarProperty to true. 我想用MenuBar创建一个JavaFX应用程序,并且希望我的应用程序看起来更像本机,所以我将useSystemMenuBarProperty设置为true。 The application looks normal, like this (just ignore IntelliJ IDEA at background): 该应用程序看起来很正常,如下所示(只需在后台忽略IntelliJ IDEA):

在此处输入图片说明

This is cool, and it works as it should. 这很酷,并且可以正常工作。 But when I minimize my application to the dock, the menubar starts to look like this: 但是,当我将应用程序最小化到扩展坞时,菜单栏开始看起来像这样:

在此处输入图片说明

As you can see, all buttons were disappeared, which is kinda strange. 如您所见,所有按钮都消失了,这有点奇怪。

The question is : How can I fix this? 问题是 :我该如何解决? What do I have to do to make it look normal? 我该怎么做才能使其看起来正常? Thanks. 谢谢。

This is indeed a strange problem which I actually haven't noticed before and I have no idea how to fix this. 这确实是一个奇怪的问题,实际上我之前从未注意到过,我也不知道如何解决。 You should probably report this as a bug. 您可能应该将此报告为错误。 At least the vanished part of the menu reappears when the window is made visible again, so this does not seem to be too serious, although it differes from the normal behaviour. 当再次使窗口可见时,菜单的消失部分至少会再次出现,因此尽管它与正常的行为有所不同,但看起来并不太严重。

If you want to make your application even more native-like you should also have a look at https://github.com/codecentric/NSMenuFX which provides some additional features which are not present in JavaFX alone. 如果您想使您的应用程序更加原生,您还应该看看https://github.com/codecentric/NSMenuFX ,它提供了一些其他功能,这些功能仅在JavaFX中是不存在的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM