Changing Runtime Application Name on Mac for JavaFX Based Application

Look at this image: http://i.imgur.com/pHIg1AA.png Can I change the application name ("My Mac application is based on JavaFX") in the menu bar of the Mac OS X system at runtime after the application starts? If this cannot be changed at run time, is there a way to change it after restarting the application? I think this name came from Info.plist. The application is built using the JavaFX ant task for Mac OS X.

Thank you

+5
source share
4 answers

When using javafx-maven-plugin, you can specify it in your pom.xml as follows:

<plugin> <groupId>com.zenjava</groupId> <artifactId>javafx-maven-plugin</artifactId> <version>8.6.0</version> <configuration> <appName>Aaa Working Title</appName> ... </configuration> ... </plugin> 
0
source

I know two ways to achieve what you want:

1) Call javafx.awt.Desktop.getDesktop from the main thread before creating any steps:

 object MYAPP { def main(args: Array[String]) = { val d = java.awt.Desktop.getDesktop // ...optionally, add handlers for interesting desktop events javafx.application.Application.launch(classOf[MyApp], args: _*) } } 

I believe that, among other things, this renames the application menu to MYAPP.

2) The application package can be used with the javapackager tool.

0
source

In fact, you can very easily change it using java command arguments
-Xdock:name=SomeName

This works great for me, running a JavaFX application in a Java11 user environment with a built-in bash script as a native application.

From the Oracle 10 documentation:

-Xdock: name = application name
Overrides the default application name displayed in the dock. [*]

-Xdock: icon = path to icon file
Overrides the default icon displayed in the dock.

[*] Also affects the menu name.

You can see my complete team by looking at 'src_macos / tmpl / George.sh' here: https://bitbucket.org/andante-george/george-application/src

For the About dialog, just do: java.awt.Desktop.getDesktop().setAboutHandler(my_about_handler) . In your handler, open any kind of dialog or window that you want.

0
source

This should work the way it always works for me: D

primaryStage.setTitle ("LOLOLOLOL");

This changes the name of your window. You can change this value at any time if you have a Stage element at your disposal.

-3
source

Source: https://habr.com/ru/post/1502669/


All Articles