如何在基于 Gluon Mobile 的项目上设置图标?

How can I set Icon on Gluon Mobile based project?

由于 start() 方法是最终方法(不能被覆盖),并且 primaryStage 在移动应用程序中有私有访问权限,我如何在我的程序上设置图标?

您可以为 Stage 实例定义图标列表:

primaryStage.getIcons().addAll(icon1, icon2, ...);

,其中 icon1、icon2 是 Image class 的实例。 Image Javadoc 解释说 BMP、PNG、GIF 和 JPEG 是必需的格式,但如果我没记错的话,您可以添加 ICO 格式的图片:icon1 = new Image("/.../logo.ico");

您可以使用该方法将所有图标添加到您的应用程序中。如 Javadoc 中所述:

The images should be different sizes of the same image and the best size will be chosen, eg. 16x16, 32,32.