JavaFX is a single-threaded toolkit. You should never query or update the UI from the background threads. So you need to wrap all the calls to the JFX classes with
Platform.runLater(new Runnable() {
@Override
public void run() {
// Update/Query the FX classes here
}
});
In your context, the code in the Console.run()
method is executed off the JavaFX application thread, so it should not be directly modifying UI objects by invoking controller.appendText()
. In your case all of the controller.appendText()
calls should be wrapped in the Platform.runLater
construct defined above.