How could I update content of several visible (at one time) components separately(independently) ?
For example, I would like to show some kind of progress indicator with connected information, and it should only be updated/painted without painting all other components on form?
Or if I have more then one components in progress and must update only their content.
How could I update content of several visible (at one time) components separately(independently) ?
Share
You can (and will have to, here) schedule your updates. You SHOULD NOT be running the long running calculation in the GUI thread (which appears unlikely, if you have a progress bar). But you still need to let the GUI know it needs to update… Something like so:
And to use it, you need a timer:
This will cause every component added to the updater to have
repaint()caller ever 500 milliseconds, forever.There are of course much more elegant ways to do this (like being able to specify update location), but this is a simple one to get you started.