I am tyring to use mvvmFX ( git link ) on Maven JavaFX project
It's just a very simple project to load an fxml file using de.saxsys.mvvmfx.FluentViewLoader
This is the sample project link (git) Sample Program
I am using :
App.java
FluentViewLoader.FxmlViewStep fvs = FluentViewLoader.fxmlView( SecondView.class );
ViewTuple vt = fvs.load();
Parent parent = vt.getView();
// Scene scene = new Scene(FluentViewLoader.fxmlView(SecondView.class).load().getView());
Scene scene = new Scene( parent );
stage.setScene(scene);
stage.show();
But i keep getting these error
Caused by: java.io.IOException: Error loading FXML - can't load from given resourcepath: /com/wiljos/SecondView.fxml
at de.saxsys.mvvmfx@1.9.0-20191021.143511-11/de.saxsys.mvvmfx.internal.viewloader.FxmlViewLoader.createFxmlLoader(FxmlViewLoader.java:285)
at de.saxsys.mvvmfx@1.9.0-20191021.143511-11/de.saxsys.mvvmfx.internal.viewloader.FxmlViewLoader.loadFxmlViewTuple(FxmlViewLoader.java:214)
Seems like the problem is, it can not find the fxml file. Can anyone help me solving this?
I compiled and ran the project. Just open your fxml directory to module mvvmfx like:
opens com.wiljos to de.saxsys.mvvmfx,javafx.fxml;
Now the fxml file can be accessed correctly by mvvmfx.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.