Java Swingworker Thread

I have a question to ask about Java Concurrency. I do Java Threading. I am creating a simple interface that has a button and JSlider in it. Therefore, when I click the button, the variable will increase, and JSlider will move accordingly. Now I wonder if Swingworker is the right choice.

+1
source share
2 answers

All you need to do is use SwingWorker for long-term tasks. What you describe will be done instantly. Therefore, you can do this in Thread Dispatch Thread, where all ActionListeners are executed.

+3
source

First you can profile save your code.

  • Examples when a state change does not block EDT: here and here .

  • An example where an action can block EDT: here .

  • An example in which an action blocks EDT: here .

+2
source

Source: https://habr.com/ru/post/1433084/


All Articles