在 Netbeans 使用的 Java 桌面应用程序模板中,菜单栏是使用 JMenuBar 和 JMenuItems 创建的。
我怎样才能让那个栏显示在顶部,菜单栏在 MacOSX 中显示,而不是像在 Windows 中那样显示在窗口中?
最佳答案
通过在您的代码中添加类似这样的内容:
if (System.getProperty("os.name").contains("Mac")) {
System.setProperty("apple.laf.useScreenMenuBar", "true");
}
关于java - MacOSX 顶部的 JMenuBar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1654531/