Closed akabachkov closed 8 years ago
It is not possible to pass the arguments to the actual application as the JavaFX API only allows for calling start(Stage stage)
on an existing application instance... one solution would be to use the Groovy metaclass to override the getParameters()
method of Application
, which would work only from Groovy (not from Java code), so your Application
would need to be written in Groovy.
Would that help you?
If not, the best I can do is make the parameters available from FXApp
, but you probably won't be able to use it from the real App...
Would it be enough in your case?
What about add next line ParametersImpl.registerParameters(app, new ParametersImpl(Arrays.asList(params))); inside FXApp.startApp()?
Hm... that's undocumented behaviour and not part of the JavaFX API... so it could break in different OSs and different JavaFX versions... not sure it's worth it.
I decided to call this unsafe method in a kind of safe way (by reflection) so that if this class ParametersImpl
does not exists in a JVM, FXAutomaton
will still work, but the parameters will not be set... this is for Java Applications. For Groovy Applications, it will always work.
FXApp.startApp( Application app, String... args ) does not pass arguments to app.