I've read the post: JavaFx 2.x - Swing : Not on FX application thread
with reference to " Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: Toolkit not initialized "
I have found a discussion here JavaFX 2.1: Toolkit not initialized
but I am not able to use the solution
"Istantiate JFXPanel in Swing Event Dispatcher Thread:"
because it stay undefined time waiting.
I have your same problem using a JInternalFrame inside a JDesktopPane.
I've tried:
final CountDownLatch latch = new CountDownLatch(1);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
final JFXPanel javafxPanel = new JFXPanel();
latch.countDown();
BorderPane pane = new BorderPane();
javafxPanel.setScene( new Scene(pane) {
Text text = new Text("Hello World");
});
frame.getContentPane().add(javafxPanel, BorderLayout.CENTER);
}
});
this.add(frame);
try {
latch.await();
} catch (InterruptedException ex) {
System.out.println("err");
Logger.getLogger(WorkspacePanel.class.getName()).log(Level.SEVERE, null, ex);
}
Where frame is a JInternalFrame and this is a JDesktopPane.
Any help ? Thanks in advance.