简体   繁体   English

Mac OS X中的自定义应用程序菜单

[英]Custom Application Menu in Mac OS X

I manage to make Mac OS X Application Menu work on Java using com.apple.eawt API and added handlers for "About App", "Preferences..." and "Quit App" menu item. 我设法使用com.apple.eawt API使Mac OS X Application Menu在Java上运行,并为“About App”,“Preferences ...”和“Quit App”菜单项添加了处理程序。

But is it possible to add some custom menu option in this Application Menu in Java? 但是可以在Java中的这个应用程序菜单中添加一些自定义菜单选项吗?

By example, Safari have "Report Bugs...", "Block Pop-Up", "Private Browsing...", etc. : 例如,Safari有“Report Bugs ...”,“Block Pop-Up”,“Private Browsing ...”等等:

替代文字

Any idea ? 任何的想法 ?

The OSXAdapter example application shows how to do this. OSXAdapter示例应用程序显示了如何执行此操作。

Addendum: 附录:

it looks like it only defines About/Preferences/Quit handlers 看起来它只定义了About/Preferences/Quit处理程序

Yes, Services and Hide/Show are supplied by the system. 是, ServicesHide/Show由系统提供。 It sounds like you want to add menu items between Preferences and Services . 听起来您想要在PreferencesServices之间添加菜单项。 Unfortunately, I've not tried that. 不幸的是,我没试过。 You might look in com.apple.eawt for alternatives. 您可以在com.apple.eawt查找替代方案。 I can see it would be convenient; 我可以看到它会很方便; but for reference, NetBeans, Eclipse, et al. 但供参考,NetBeans,Eclipse 等。 use the existing functionality. 使用现有功能。

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

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