Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: thread v. timer in ProgressMonitor subclass




On Dec 18, 2007, at 10:03 PM, Paul Archibald wrote:

I call it just before the execution that it is going to monitor is launched, like his:

model.setup();
ExecutionProgressMonitor epmon = new ExecutionProgressMonitor(model); // the model is what we monitor
model.run();// this can take a while, its what I want to monitor.


So, my problem is that I never see my monitor, no matter how long the execution process takes. The Timer thing works, because I get a bunch of my Update objects created, but it all happens AFTER the call to model.run(), which is not very useful. Its as though the Timer is somehow not getting started up or something.

That looks like you are running your model on the same thread as the ProgressMonitor (i.e., the user interface thread). I think you need to spawn a new thread and run the model from that. Otherwise the UI won't update until model.run() is finished.
--
Rick Genter
email@hidden




_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >thread v. timer in ProgressMonitor subclass (From: Paul Archibald <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.