First off, I am coming from C++ / C# and do not have a deep knowledge of java.
I made a GUI using Window Builder to handle some SmartHome stuff. I am using Paho Mqtt V3 to receive updates. Just changing f.e. a String variable in a class works fine.
Problem occurs when I try to update something within the GUI, f.e. some text of a simple text field: If I call the SetText()-method from the callback method of the Mqtt client on receive, an "Invalid thread access"-exception is thrown. I have also tried to use a callback, which results in the same error.
What is the best way to achieve an update? Surely, I could try to write an independent task only looping and delaying, waiting for f.e. a boolean set when an update is received. But this seems a bit exessive, doesn´t it?
I have deliberately refrained from posting code snippets at this point, since this is a general question, and (probably) not a direct problem in the implementation.
Thanks for your input.