Solution
You should set your controller into an FXMLLoader. For example, use code similar to that below inside your Homenizer start method.
FXMLLoader loader = new FXMLLoader(
getClass().getResource("/homenizer/view/HomenizerView.fxml")
);
loader.setController(this);
Parent root = (Parent) loader.load();
Explanation
why must I set the Controller inside my Controller class? I set the controller in my fxml file this didn't work
Because your startHomenizer method is not a static method, you must have already created an instance of your Homenizer class, which is also a Controller, because it has @FXML
annotated members.
If you just ask the FXMLLoader to load without first setting your current instance of your Homenizer into the FXMLLoader, then the loader will create a new Hominizer instance, so you would end up with two instances, one created by the loader with the @FXML members initialized and one created by you without the @FXML members initialized. This is confusing and probably not what you want.
What you probably want is a single instance of the Homenizer class. To do that, you need to set the instance you created into the FXMLLoader and the loader will make use of your existing class instead of creating a new one (as long as there is no fx:controller
defined in the loaded FXML).
There is some more discussion in the answer to: Passing Parameters JavaFX FXML.