Substance and MacOS MenuBar

ぃ、小莉子 提交于 2019-12-05 08:36:59

Yes, as shown below.

$ java -Xdock:name=MyApp -Dswing.defaultlaf=com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel -jar MyApp.jar

You can specify the UI for menu bar alone like this:

                try {
                    UIManager.setLookAndFeel(new SubstanceBusinessBlackSteelLookAndFeel());
                } catch (UnsupportedLookAndFeelException ex) {
                    // log...
                }

                JMenuBar menubar = frame.getJMenuBar(); // assuming you've set the menu bar already
                String os = System.getProperty("os.name");

                if (os.equals("Mac OS X")) {
                    try {
                        System.setProperty("apple.laf.useScreenMenuBar", "true");
                        menubar.setUI((MenuBarUI) Class.forName("com.apple.laf.AquaMenuBarUI").newInstance());
                    } catch (Exception ex) {
                        // log...
                    }
                }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!