Skip to content
Advertisement

Javafx 2.0 How-to Application.getParameters() in a Controller.java file

Considering the following sample.

How to access to arguments/parameters of the application in the controller?

Thank you.


NB: I’ve tried to mix App.java and MyController.java in only one Class file, but didn’t help.


App.java (simplified):

JavaScript

MyController.java (simplified):

JavaScript

MyView.fxml (simplified):

JavaScript

Advertisement

Answer

1. The most straightforward way is to save them in the app:

JavaScript

and read them in the controller:

JavaScript

2. A bit more complex (and better in general) approaches are described in the next answers:

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement