How-To Progress Monitor

Holger Mappt holgerosm at gmx.net
Sat Oct 22 15:07:29 UTC 2016


Hi,

I'm writing a plugin that processes a number of images after a menu item 
was selected.  What is the right way to do that in a way that doesn't 
block the GUI with an indication of the progress?  I guess I have to run 
some kind of task that updates the progress after every image.  Then 
some GUI component displays a progress bar (with an optional cancel 
button).  I implemented something that is based on 
javax.swing.ProgressMonitor and javax.swing.SwingWorker according to the 
code sample from the Java tutorial 
(https://docs.oracle.com/javase/tutorial/uiswing/examples/components/ProgressMonitorDemoProject/src/components/ProgressMonitorDemo.java), 
but it's not working.  The progress window opens after the 101st image 
and then blocks the execution of the task.

What is the recommended JOSM way to do that?  Is there a good example 
where I can learn from?  JOSM has a ProgressMonitor interface and some 
classes that implement it, but there is no documentation and the plugins 
I looked at are quite complex with an endless chain of subroutines.  Any 
help is appreciated.

Thanks,
Holger



More information about the josm-dev mailing list