如何使用Scene Builder将背景图像添加到AnchorPane
?如何使用JavaFX中的Scene Builder将Anchor-image添加到AnchorPane中?
我已经尝试过为:
-fx-background-image url('C:/Users/Documents/page_background.gif')
我如何设置这Scene Builder。
而产生FXML:
<AnchorPane id="LoginAnchorPane" fx:id="LoginAnchorPane" prefHeight="400.0" prefWidth="600.0" style="-fx-background-image: url('C:/Users/Documents/page_background.gif');" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="javafx_lsdu.LoginController">
*“绝对格式”*在这里是错误的。它要求指定* scheme/protocol *,否则将使用类加载器进行查找。此外,它也应该存在于CSS文件中。 – fabian
感谢您的纠正,我已经更新了答案。 – DVarga