In my school project (simple Swing application) I have a class that does some computational stuff (trains neural network) and this computation runs in iterations. I would like to actualize some GUI components (JProgressBar
) and show to the user what iteration is actually processed (e.g. 100/10000).
I would like to ask how to accomplish it with respect to application design. I don't want to mix computation code with code for refreshing GUI components. Is it a proper situation to use Observer design pattern? If so, I can set my computation class as an observable object and register observer - class that will actualize JProgressBar
.
Is it ok or is there some better way how to achieve it?