I need to change jlabel.text several times by one click button in swing. In this code i need set label text to start before dowork() function and set to in progress in middle a
Never, NEVER use Thread.sleep
, Thead.yield
in the ETD
Never, NEVER perform any blocking actions in the ETD
, such as extended IO or data processing
The reason that the label is not changing is because you are stalling/blocking the ETD
, preventing it from processing any repaint requests.
Check out Concurrency in Swing & The Event Dispatching Thread