Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Tutorial JavaFX for Beginners

Joined
Mar 29, 2016
Messages
54
My controller was not getting used even after calling setController.

Changing this
Code:
// Load fxml file
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setController(new GUIController(script, this));
final Parent root = fxmlLoader.load(getClass().getResource("sample.fxml"));

to this
Code:
// Load fxml file
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("sample.fxml"));
fxmlLoader.setController(new GUIController(script, this));
final Parent root = fxmlLoader.load();

solved the problem.
 
Joined
Nov 26, 2014
Messages
616
I would recommend Scene Builder - Gluon instead of the Oracle Scene Builder, as this one is much more up to date. Alternatively, you could download the source of Oracle's Scene Builder and compile everything yourself, but why would you.

Edit: oh, someone already mentioned it.
I'm probably going to remake this for the Spectre UI, thanks for the link, it looks way better than vanilla Scene Builder.
 
Top