我在项目的根目录中有一个资源文件夹,其中包含所有FXML文件和图像。如何使用FXMLLoader将FXML文件加载到单独的目录中?getClass()
和getResourceAsStream()
方法对我不起作用。谢谢你
MAIN("/resources/view/scenes/main.fxml");
private final String scene;
FXMLPath(final String scene) {
this.scene = scene;
}
public String getPath() {
return this.scene;
}
final Parent parent = FXMLLoader.load(getClass().getResource(scene.getPath()));