Launching and controlling JavaFX application from within Java-Application

Hi all,

now that I’ve waited enough years to FINALLY play Videos on all platforms with JavaFX/Java8, my happiness couldn’t be bigger. Actually it could, if I solve my very last problem.
The video is played from within a Slick2D game, which builds up on a completely different graphical framework. I don’t know how to embed a JavaFX container in Slick, so I planned to just open a second JavaFX video and dispose it once the video has finished.

That works fine. Once.

I didn’t read the manual carefully enough that says that Application.launch(…) can be called only exactly once. so If I want to show the video a second time, I can’t start the Video-Container like that. I thought, no problem, let’s recycle the object then and just hide the window instead. Unfortunately, through the static way that you launch the application, there is no way to obtain a reference to the Java-FX container object.

What I have to do is:

Application.launch(VideoPlayer.class)

What I want to do is:


VidePlayer player = Application.launch(VideoPlayer.class);
...  
player.reset();
player.start();

There must be way to control the Java-FX container or not??

Be sure to use:
Platform.setImplicitExit(false);