Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SceneBuilder 2: Do controller classes need to necessarily be in the same folder as the view FXML files?

I'm loving JavaFX and SceneBuilder, but I just can't figure out how to make SceneBuilder link my FXML views with their Java controllers when they are not in the same folder. I'd just like to have this folder structure:

  package
     |-- model
     |-- view
     |   |--someElementView.fxml
     |   \--anotherElementView.fxml
     \-- control
         |--someElementController.java
         \--anotherElementController.java  

Instead I can only make SceneBuilder recognise my controllers if I have this folder structure which I'd like to avoid:

package
 |-- model
 \-- view
     |--someElementView.fxml
     |--anotherElementView.fxml
     |--someElementController.java
     \--anotherElementController.java 

What happens is that when the FXML and java files are all in the same folder, SceneBuilder detects them and shows a dropdown list with the java controllers (i.e. "package.view.someElementController" and "package.view.anotherElementController") for me to choose from and everything works nicely.

If I have a project with the folder structure with the controllers in a separate folder, SceneBuilder won't offer me any option to assign a controller class. If I just type it in the controller text field (i.e. "package.control.someElementController" or "package.control.someElementController"), it still won't pick up the @FXML variables defined in the java controller.

Is this a bug in Scene Builder or am I approaching things the wrong way? I have always have the controllers and the views in different folders, and since it's a big project, I'd like to keep things tidy.

like image 541
zapatilla Avatar asked Oct 20 '22 16:10

zapatilla


1 Answers

This is a limitation of Scene Builder. Vote for DTL-5573 and DTL-5124.

like image 182
Ryan J Avatar answered Oct 22 '22 19:10

Ryan J