如何添加自定义css属性,例如-fx-accent
或-fx-base
。
我尝试过一种天真的方式:
.root {
-fx-small: 20;
}
.button {
-fx-font-size: -fx-small;
}
不幸的是,我得到了:
警告:com.sun.javafx.css.parser.CSSParser声明CSS错误解析文件:/home/ark/Projects/FXTest/out/production/FXTest/a.css:预期'<数>”在[6,15]
解析'-fx-font-size'时
答案 0 :(得分:0)
我从不使用-fx前缀进行全局定义。对我来说,它的工作方式就像在幻灯片32上显示的那样:http://de.slideshare.net/ClaudineZillmann/lets-get-wetbestpracticesforskinningjavafxcontrols
也许数字格式存在错误。你试过20.0吗?
答案 1 :(得分:0)
JavaFX自定义CSS-Variables不支持数字!
您可以定义自定义颜色。
.root {
-fx-color: red;
}
.button {
-fx-background-color: -fx-color;
}
Sry兄弟,也许将来会发布..
编码愉快,
Kalasch