I am trying to run two threads for my JavaFX program. The first thread (We'll call thread 1) is built to collect sensor input from a rangefinder sensor and a camera. Thread 1 updates a variable within the StageWithData (a class that inherits Stage). That variable is then tied to a label in my second GUI thread. The connection is formed using the "bind" method. However, whenever the sensor updates, Java gives me an error
"Thread-4 javalang.IllegalStateExpression: Not on FX application thread; currentThread = Thread-4"
I understand why the error occurs, just do not know how to fix it.
Any advice? I am pretty new to threading.
Thanks!