Update Value of Label during long runtime


I want to update the value of a textfield during the runtime of a ClickListener.

The whole process takes 30 seconds, and I want to display something in a Textfield to show the users that the program is running.
How can i do that? I tried to set it with setValue, but that only changes after the exectue is done.

Thanks for the help and if you need some snippets, ask away!

Best Regards,

Hello Patrick,

I think this documentation about asynchronous Updates could be the solution to your problem


You have to create and run a Thread when the button is clicked, when the thread finishes (after 30 seconds in you case) you can update the UI’s components from the thread like this:

ui.access(() -> {

If the push mode is manual, you need to push the pending UI changes to the browser explicitly with the push() method.

You can set the push mode using the @Push annotation. If the push is set to automatic, you do not need to write ui.push();.