I'm not sure what you mean, but by default, the screen image (reflecting the changes on the display) is executed in a separate single thread (for example, see the Swing framework). This is due to the fact that it is quite difficult to allow multiple threads to draw on the screen without delving into what is happening - only a few implementations do this. Therefore, if you plan to independently implement the graphical user interface infrastructure, it is recommended to use a single-threaded drawing approach.
As for your business logic, it depends on many factors. A very simple approach could indeed generate a new stream for each type of activity. Then, these threads can send the result to the specified GUI thread. The problem with this approach is that efficiency can be significantly reduced if many actions are performed simultaneously, since in Java each thread is mapped to a thread of its own OS. To avoid this, you can use thread pools. The Java standard library provides thread pools like ThreadPoolExecutor or if you want a higher abstraction, ExecutorService .
source share