Search code examples
javaswingdesign-patternsjprogressbar

Long running process, show progress in UI


I want to trigger a long running background process (coded as a service) from the ui. But I also want to show some progress of that task to the user.

How can I achieve this? (I want to not infringe on decoupling). Is there a best practice to solve it (combining design-patterns, eg. observer and command)?


Solution

  • Here is an example on how to use just the observer pattern to show progress in the UI. With JAVA sample code provided:

    Using Observer Pattern to track progress while loading a page