I'm creating an java application on a Mac that uses Swing JMenu
s. I would like to use the menu bar on the top of the screen, but it keeps on putting the menu bar in the frame itself. How do you move the menu bar to the top of the screen on a Mac?
Asked
Active
Viewed 4,107 times
3

Kevin Reid
- 37,492
- 13
- 80
- 108

Anonymous181
- 1,863
- 6
- 24
- 27
-
possible duplicate of [Native Swing Menu Bar Support For MacOS X In Java](http://stackoverflow.com/questions/307024/native-swing-menu-bar-support-for-macos-x-in-java) – Perception Apr 28 '12 at 18:44
-
strange, my (slightly old, OSX 10.5 running) Apple laptop automatically puts them up there... What have you tried till now? Perhaps I used another way, then I can give you my code and then you wouldn't need to mess with system properties. – 11684 Apr 28 '12 at 19:58
-
possible duplicate of [How do I move my JMenuBar to the screen menu bar on Mac OS X?](http://stackoverflow.com/questions/8955638/how-do-i-move-my-jmenubar-to-the-screen-menu-bar-on-mac-os-x) – trashgod Apr 29 '12 at 01:51
1 Answers
13
You can set a System property to do so. The first example on http://developer.apple.com/library/mac/#documentation/Java/Reference/Java_PropertiesRef/Articles/JavaSystemProperties.html mentions to use System.setProperty("apple.laf.useScreenMenuBar", "true");
to put your menu into the menubar.

cello
- 5,356
- 3
- 23
- 28