Please take a look at this image: http://i.imgur.com/pHIg1AA.png Is it possible to change the application name ("My JavaFX-based Mac App") in the Mac OS X system menu bar at runtime after the app starts? If it's not possible to change at runtime, is there a way to change it after app restarts? I think that name came from Info.plist. The app is built using JavaFX ant task for Mac OS X.
Thanks.
Actually, you can change it very easily by using the java-command args
-Xdock:name=SomeName
This works fine for me, launching a JavaFX application on a Java11 custom-built runtime with a bash-script as a native application.
From the Oracles Java 10 documentation:
[*] Also affects the menu name.
You can see my complete command by looking for 'src_macos/tmpl/George.sh' here: https://bitbucket.org/andante-george/george-application/src
For the About-dialog simply do do:
java.awt.Desktop.getDesktop().setAboutHandler(my_about_handler)
. In your handler open whatever kind of dialog or window you want.I'm aware of two methods of achieving what you want:
1) Call
javafx.awt.Desktop.getDesktop
from the main thread before creating any stages:I believe, among other things, this renames the application menu to MYAPP.
2) Package your application using the
javapackager
tool.When using javafx-maven-plugin you can specify it in your pom.xml like this:
That should work as is always worked for me :D
primaryStage.setTitle("LOLOLOLOL");
This changes your window's name. You can change this value at any time, if you have the
Stage
element at your disposal.