CSS更改JFXRadioButton中的单选按钮颜色 [英] CSS Change radio button color in JFXRadioButton
问题描述
我在此库中设置JFXRadioButton
的样式时遇到问题:
jfoenix.com
I have a problem with styling JFXRadioButton
from this library :
jfoenix.com
我想更改颜色或圆圈,但是默认类无效.你有什么想法吗?
I would like to change the color or circle, but default class didn't work. Have you to any ideas?
(仅用于测试的颜色.)
(Colors for tests only.. )
.radioButtonFX .radio:selected {
-fx-background-color: yellow;
}
.radioButtonFX .radio-button .radio:selected {
-fx-background-color: blue;
}
我还要更改JFXRippler
的颜色和JFXTabPane
中选定选项卡的行
I would like also change the color of JFXRippler
and the line for selected tab in JFXTabPane
推荐答案
JFXRadioButton
分配代码中的颜色.这优先于分配的值.修改CSS的唯一方法是使用JFXRadioButton
本身的-fx-selected-color
和-fx-unselected-color
属性:
JFXRadioButton
assigns the color from code. This takes precedence over values assigned. The only way to modify this from CSS is using the -fx-selected-color
and -fx-unselected-color
properties of the JFXRadioButton
itself:
.jfx-radio-button {
-fx-selected-color: yellow;
-fx-unselected-color: blue;
}
关于波纹颜色
.jfx-rippler {
-fx-rippler-fill: lime;
}
以及所选标签下方的行
.jfx-tab-pane .tab-selected-line {
-fx-stroke: red;
}
请注意,这里有一个 Node
中的getCssMetaData
方法,它使您可以检索可用属性的列表.
Note that there is a getCssMetaData
method in Node
, which allows you to retrieve a list of available properties.
radio.getCssMetaData().stream().map(CssMetaData::getProperty).forEach(System.out::println);
最后一个属性应该是JFX控件之一...
The last properties should be the one of the JFX control...
但这不适用于JTabPane
,因为它们是Node
子级的属性.对于该信息,似乎有必要深入研究JFXTabPane
的默认外观的代码,因为JFoenix似乎在为该类编写属性文档方面做得很糟糕.
This does not work for JTabPane
however, since those are properties of a child of the Node
. For that info it seems to be necessary to dig through the code of the default skin for JFXTabPane
, since JFoenix seems to have done a awful job at writing propert documententatiion for it's classes.
这篇关于CSS更改JFXRadioButton中的单选按钮颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!