Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Abion47

macrumors newbie
Original poster
Jun 3, 2010
2
0
Looking around this forum and Google, I see a lot of examples of using:

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

for setting the JMenuBar in the Mac Menu in the upper left. The only problem is that it doesn't really work in a multi-JFrame environment, since there's a different menu bar for each JFrame.

Is there a way to make a universal menu bar that stays visible and has the same functionality over every instance of JFrame? Or do I have to basically duplicate my JMenu code over every single class that extends JFrame?
 
If you are unconcerned with portability, then use the package com.apple.eawt as the central UI Window.

Your other option is to create an OSX specific bundle where you can place your system properties.

Otherwise, simply use the -Dapple.laf.useScreenMenuBar=true parameter in the command line.

Oracle has a fine intro titled Bringing your Java Application to Mac OS X that should explain the specific changes you would make.
 
If you are unconcerned with portability, then use the package com.apple.eawt as the central UI Window.

Your other option is to create an OSX specific bundle where you can place your system properties.

Otherwise, simply use the -Dapple.laf.useScreenMenuBar=true parameter in the command line.

Oracle has a fine intro titled Bringing your Java Application to Mac OS X that should explain the specific changes you would make.

All this is pure gold for developing Java applications on a Mac, but I didn't see anywhere in those links about creating a universal menu bar. Maybe I'm just blind...?

What I'm talking about is making a universal file menu, edit menu, format, tools, options, etc., not customizing the "About this program" or preferences.
 
Your options are to write your own JFrame and subclass all other JFrames from that, or control the JMenu instance in each JFrame through a single factory.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.