code: public static void runInFX(Runnable doRun) {
          if (Platform.isFxApplicationThread()) {
              doRun.run();
              return;
          }
          Platform.runLater(doRun);
      }
docs: This method is used to run a specified Runnable in the FX Application thread,
  it returns before the task finished execution
  
  @param doRun This is the sepcifed task to be excuted by the FX Application thread
  @return Nothing