How To Fix Toolkit Not Initialized Error In Java FX

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...

3 comments

  1. I desired to thank you for this exceptional read!! I absolutely enjoyed every single small little bit of it. I’ve you bookmarked your internet site to look at out the new stuff you post.

Leave a Reply

Your email address will not be published. Required fields are marked *