You are trying to update a progress bar from the thread that is processing the work: which means that the actual display can't be updated until that method exits because the thread which does the display updates is busy - sleeping and trying to update the progress bar ...
You need to move the "long running work" onto a different thread:
Multithreading in Java - GeeksforGeeks[
^]