title: JavaFX trigger object creation at runtime from a distinct thread
body: <p>I have two threads, each one having its own function: one deals with reading input from a socket and the other one is a GUI related thread (uses JavaFX).</p>
  
  <p>The reading thread contains a reference to the Runnable object that the GUI thread was created from. When the reading thread receives an object of a certain type, it calls a method from the GUI thread.</p>
  
  <p>This method should create a new Button labeled with some text that was received through the socket. However, then trying to instantiate a new Button, I get the following exception:</p>
  
  <p><code>Exception in thread "Thread-4" java.lang.IllegalStateException: Not on FX application thread; currentThread = Thread-4</code>.</p>
  
  <p>I mention that when I try to update an existing component everything works fine and this exception is not thrown anymore, so I concluded that the object creation is what triggers the exception.</p>
  
  <p>Is it possible to command the instantiation of a class from a different thread (as described above)? If not, are there any workarounds to achieve the same result?</p>
  
  <p>Thank you!</p>