I bet you used Java FX with Swing, hence you ended up with this problem. Sure, the tutorial leads developers into thinking that the class has to inherit Application in order to launch Java FX applications or put them in a JFXPanel container if they want to use it hand in hand with Swing.

In my case, I used Swing to open a modal Java FX window. When my code executed Platform.runLater(), that error came out.

It took me some time to figure out the solution to set up a Java FX toolkit environment in order to run Java FX applications without having to use a class that inherits Application or integrate a Stage container into the JFXPanel.

The quick solution to setting up the Java FX toolkit is to instantiate JFXPanel without even using it. Just instantiate it and then you can use Platform.runLater().

Here is a sample code.

Related Posts Plugin for WordPress, Blogger...