FXML
将关联文件添加到每个css
文件:
<stylesheets>
<URL value="@stylesheet.css" />
</stylesheets>
确保它stylesheet.css
位于CLASSPATH
.
编辑:如果您想要一个全局文件css
用于多个fxml
文件,请将 添加到您的文件fx:id
的根窗格中,并在您的,中使用默认值。fxml
ID
css
root
#fxml_1 {
... style from the fxml file with fx:id = "fxml_1", and so on
}