roskenet / springboot-javafx-support

SpringBoot / JavaFX8 Integration
MIT License
419 stars 140 forks source link

Can't set controller in HelloworldJavaView demo #84

Open yrcs opened 5 years ago

yrcs commented 5 years ago

As the title say, there is the only one way to set the view's controller via "fx:controller" in fxml file and no way can set the controller via the pure java code.

co5dt commented 5 years ago

Found a solution?

yrcs commented 5 years ago

Found a solution? I am using mvvmfx, it can also work with Spring Boot. https://github.com/sialcasa/mvvmFX

balazsvero commented 1 year ago

Since there was no answer for this for a long time: you can set either the controller or a controller factory in the FXMLLoader instance, but then you omit it in the .fxml file. As I saw, the controllerFactory is set in the view, so if you use this library, you don't have to set it in the .fxml