作为标题,是否可以将默认颜色应用于TextFlow组件的所有文本?
TextFlow textFlow = new TextFlow();
textFlow.setId("supertextflow");
// Somewhere else in the code
textFlow.getChildren()
.add(new Text("Dynamic added text! OMG!"));
我尝试了不同的解决方案,但它们都没有起作用。
#supertextflow {
-fx-text-fill: red;
}
#supertextflow * .text{
-fx-fill: red;
}
#supertextflow > * > .text {
-fx-fill: red;
}
我知道Text是另一个组件,但为什么我不能从它的父组件中对其进行样式设置?
Text
实例上设置样式类或ID,它是否可以使用类型选择器来工作,例如#supertextflow > Text { -fx-fill: red; }
? - undefined#supertextflow > .text
不起作用,但是使用#supertextflow > Text
替代将能解决问题。感谢你指出这一点。 - undefined