I'm trying to change the application name displayed into the menu bar of OS X but i can't succeed with that. I have tried settings as the first statement in the main method with the following code :
System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Alessio"); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
but it doesn't work, in the menu bar is displayed main :
I'm on Mac OS X Lion (10.7.2).
Is there a way to change the application name in the menu bar? If so, how?
Using JDK8, you can set the apple.awt.application.name
property to affect the Application menu name.
However, Martijn Courteaux’s warning still applies: you must do this before any AWT classes are loaded. And AWT classes will be loaded before your main()
method runs if it lives in a subclass of JFrame
.
Reference:
http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/5c1d06cd7d7b/src/macosx/native/sun/osxapp/NSApplicationAWT.m#l157
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With