Put your JMenuBar on the Mac menu bar

By Alvin J. Alexander, devdaily.com

Question: I'm creating a Java/Swing application for Mac OS X ... how do I put my Java menu bar (JMenuBar) on the Mac menu bar?

Answer: In your Java application, set the system property apple.laf.useScreenMenuBar to true, like this:

System.setProperty("apple.laf.useScreenMenuBar", "true");

You'll see that this moves the menu bar off of your JFrame and onto the Mac OS X system menu bar.

Related posts


devdaily logo