Mac Menu Bar Issue

R

Rationem

I am trying to move the menu bar for my java app to the top of the
screen while it is running on a mac.

I have the following code but it has no effect:

System.setProperty("com.apple.macos.useScreenMenuBar", "true");
System.setProperty("apple.awt.brushMetalLook", "true");
System.setProperty("apple.laf.useScreenMenuBar", "true");
System.setProperty("com.apple.mrj.application.apple.menu.about.name",
"Viewer");

The menu bar is still atached to the JFrame - any ideas?

Thanks,
Adam
 
S

Steve W. Jackson

Rationem said:
I am trying to move the menu bar for my java app to the top of the
screen while it is running on a mac.

I have the following code but it has no effect:

System.setProperty("com.apple.macos.useScreenMenuBar", "true");
System.setProperty("apple.awt.brushMetalLook", "true");
System.setProperty("apple.laf.useScreenMenuBar", "true");
System.setProperty("com.apple.mrj.application.apple.menu.about.name",
"Viewer");

The menu bar is still atached to the JFrame - any ideas?

Thanks,
Adam

The last time I checked Apple's site, most of those properties could
indeed be set either via the command line (using -D) or by using the
System.setProperty call. I haven't tried the latter. But in order for
it to matter, it will have to be done very early in your code -- meaning
before you begin constructing your Swing components -- or you'll need to
force an update of the UI.

You'll also need to make sure you've got the correct property names.
According to Apple's site, apple.laf.useScreenMenuBar is the correct
property to use the top menu instead of one inside your JFrame.

As a simple test, you could try those properties on the command line
first. When launching your application, make sure that the command line
includes -Dapple.laf.useScreenMenuBar=true for the first one, for
example. And get the most up to date Java documentation at
<http://developer.apple.com/documentation/Java/index-date.html>.

= Steve =
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top