简体   繁体   English

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

[英]How can I set Icon on Gluon Mobile based project?

Since the start() method is final (cannot be overridden), and primaryStage has a private access in Mobile Application how can I set Icon on my program?由于start()方法是最终的(不能被覆盖),并且primaryStage在移动应用程序中具有私有访问权限,我如何在我的程序上设置图标?

You can define a list of icons to a Stage instance:您可以为Stage实例定义图标列表:

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

, where icon1, icon2 are instances of the Image class. The Image Javadoc explains that BMP, PNG, GIF and JPEG are the required formats but if I remember well, you can add a picture with the ICO format: icon1 = new Image("/.../logo.ico"); ,其中 icon1,icon2 是Image class 的实例。Image Javadoc解释说 BMP、PNG、GIF 和 JPEG 是必需的格式,但如果我没记错的话,您可以添加 ICO 格式的图片: icon1 = new Image("/.../logo.ico");

You can add all your icons to your application using that method.您可以使用该方法将所有图标添加到您的应用程序中。 As explained in the Javadoc :Javadoc中所述:

The images should be different sizes of the same image and the best size will be chosen, eg.图像应该是同一图像的不同尺寸,并且将选择最佳尺寸,例如。 16x16, 32,32. 16x16、32,32。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM