gpt4 book ai didi

css - 在 javafx native 包中显示添加到 .css 文件中的图像的问题

转载 作者:行者123 更新时间:2023-12-04 23:55:41 24 4
gpt4 key购买 nike

Javafx native 包不显示添加到 .css 文件中的任何图像

因为我正在使用位于我的元素“/styles/style.css”中的 .css 文件我正在给一个场景来获得风格,

Scene scene = new Scene(parent, 1080, 800);
scene.getStylesheets().add("/styles/style.css");

为了将图像设置到 css 中,我尝试了两种方法:

-fx-graphic: url("../images/delete_hover.png") no-repeat;

-fx-background-image:url("../images/bgLeft.jpg");

但我没有解决。

我在哪里将颜色或字体设置到 css 文件而不是图像可以请建议...

最佳答案

解压后的 jar 我注意到 style.css 被转换成 style.bss 即二进制格式。

在构建包时将 css 转换为 bss false,即在 pom.xml 中

<css2bin>false </css2bin>

这解决了问题:)

关于css - 在 javafx native 包中显示添加到 .css 文件中的图像的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15894109/

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