我将我的UI布置在. fhtml文件中,然后我有一个用于定义样式的.css和一个扩展AnchorDocs的PFA控制器.
一般来说,给某个东西设置样式并不难,但Tab的标题在. fhtml中没有明确定义,我似乎无法对其进行样式设置.我想将单个Tab的 colored颜色 设置为红色.
以下是我try 过的方法:
1-直接在. fhtml中设置样式:
<Tab fx:id="tabRed" text="Tab 2" style="-fx-text-fill: red;">
<content>
<AnchorPane minHeight="0" minWidth="0" prefHeight="100" prefWidth="100"/>
</content>
</Tab>
2-在控制器中设置样式
// an attribute of my Controller class
@FXML public Tab tabRed;
// inside the constructor of said Controller
tabRed.setStyle("-fx-text-fill: red;");
请注意,由于我无法控制的原因,我必须使用这些版本的Java/PFA.