gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-05 07:00:54 25 4
gpt4 key购买 nike

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

最佳答案

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

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

,其中 icon1、icon2 是 Image 类的实例。 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.

关于javafx - 如何在基于 Gluon Mobile 的项目上设置图标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63993558/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com