Skip to content
Advertisement

How do I move my JMenuBar to the screen menu bar on Mac OS X?

When I move my JMenuBar to the screen menu bar on Mac OS X, it leaves some blank space where the menu would be in my window; I need to remove that space. I am using

JavaScript

to move my JMenuBar to the screen menu bar. My friend who uses a Mac reports that this leaves some ugly vertical space where the menu would reside if I did not set that property. What is the best way to resolve this issue?

EDIT: Here is an example from my source:

JavaScript

Advertisement

Answer

Depending on when it’s done, setting the property after your program launches may be too late to be effective. Instead, add the setting at launch time.

JavaScript

Alternatively, set the property in your application bundle’s Info.plist, as discussed in Java Deployment Options for Mac OS X, Java Dictionary Info.plist Keys, About Info.plist Keys and Java Runtime System Properties.

JavaScript

Addendum: As shown below, the problem does not appear using the approach suggested by @Urs Reupke or myself. Your (missing) DesktopMain may be at fault.

Screen capture

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement