Shawn Shroyer
Shawn Shroyer

Reputation: 923

Javax JMenuBar with Mac

When I try to add a JMenuBar to my frame in Mac, it doesn't show up. I assume it's because JMenuBar isn't integrated into the Mac native method. So can anybody help me with the code that I can use to make my bar viewable?

Upvotes: 2

Views: 206

Answers (3)

trashgod
trashgod

Reputation: 205785

You can also set the apple.laf.useScreenMenuBar property to true in your Info.plist, as shown here.

Upvotes: 3

Dean
Dean

Reputation: 8978

Firstly it you need to tell the JVM to use the MenuBar like:

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

Then in your JFrame set the menu bar like so:

frame.setJMenuBar(new MenuBar());

Upvotes: 4

Guillaume Polet
Guillaume Polet

Reputation: 47608

Add the following VM argument to the java call:

-Dapple.laf.useScreenMenuBar=true

Upvotes: 3

Related Questions