title: Launch JavaFx application from Swing JApplet class
body: <p>I have to launch a JavaFx application on a click of a JMenuItem of a tree node which extends JApplet class and runs on Swing JFrame window.</p>
  
  <p>I had gone through the tutorials on JavaFx in Swing applications 
  <a href="https://docs.oracle.com/javase/8/javafx/interoperability-tutorial/swing-fx-interoperability.htm" rel="nofollow noreferrer">https://docs.oracle.com/javase/8/javafx/interoperability-tutorial/swing-fx-interoperability.htm</a> and this question <a href="https://stackoverflow.com/questions/42816859/run-javafx-and-swing-application-at-the-same-time">Run javafx and swing application at the same time</a> and understood that I have to work JavaFx data on JavaFx application thread.</p>
  
  <p>So I tired to launch the JavaFx application through Platorm.runlater thread on the click of the JMenuItem and made sure that the JavaFx application implements Runnable interface but still I encountered this error : <a href="https://i.stack.imgur.com/Qekew.png" rel="nofollow noreferrer">ToolKit not initialized</a>.</p>
  
  <p>Here is the sample code of JMenuItem that launches JavaFx Application</p>
  
  <pre><code>    static class OpenJavaFxApp extends JMenuItem{
      OpenJavaFxApp(){   
         super("JavaFx App");
          // This should launch JavaFx app
         this.addActionListner(actionEvent -&gt; Platform.runLater(() -&gt;{
                  try{
                       // JavaFx app extends Application and 
                       //impelents Runnable 
                       JavaFxApp app = new JavaFxApp;
                       Stage anotherstage = new Stage();
                       app.start(anotherstage);
                       } catch(Exception e){
                           e.printstacktrace();
                           }
                     })
               );
           }
       }
  </code></pre>
  
  <p>Sample JavaFx app code</p>
  
  <pre><code>     public class JavaFxApp extends Application implements Runnable{
  
          @Override
          public void start(Stage primaryStage){
            AnchorPane pane = new AnchorPane();
            pane.getChildren().addall(AddSomething);
            Scene scene = new Scene(pane);
            primaryStage.setScene(scene);
            primaryStage.show();
          }
  
          public static void main(Strings[] args){
                launch(args);
          }
  
          @Override
          public void run(){
               launch();
          }
        }
  </code></pre>
  
  <p>Please be a little bit specific with your solution but any help is appreciated.  Thanks:)</p>