Re: ProgressMonitor takes too long to display in Sun's ProgressMonitorDemo
- From: abbomb@xxxxxxxxxxx
- Date: 29 Jun 2005 10:15:03 -0700
Skip,
I appreciate your advice. I tried adding a yield() call in the
ActualTask and also tried lowering the worker thread's priority to
Thread.MIN_PRIORITY. However, neither had any effect on how quickly
the ProgressMonitor displayed.
Are there any other suggestions on how to get the ProgessMonitor to
display more quickly?
For your information, the ActualTask's constructor is as follows:
ActualTask() {
//Fake a long task,
//making a random amount of progress every second.
//Thread.currentThread().yield();
while (!canceled && !done) {
try {
Thread.sleep(10000);
current += Math.random() * 100; //make some progress
if (current >= lengthOfTask) {
done = true;
current = lengthOfTask;
}
statMessage = "Completed " + current +
" out of " + lengthOfTask + ".";
} catch (InterruptedException e) {
System.out.println("ActualTask interrupted");
}
}
}
Skip wrote:
> <abbomb@xxxxxxxxxxx> wrote in message
> news:1120002374.520310.294150@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> > Why does it take so long for the ProgressMonitor to display in this
> > case? How do I get it to display immediately? Note that I have tried
> > using the ProgressMonitor.setMillisToDecideToPopup method but it has no
> > effect.
>
> Your thread might be so cpu-intensive that the cpu doesn't have much cycles
> left to initiate that GUI. You might want to either lower the
> thread-priority a bit, or Thread.yield() a couple of times in your
> worker-thread.
.
- References:
- Prev by Date: Re: Place JComponent in center of JDialog
- Next by Date: Re: highlighting word in JPEG image
- Previous by thread: Re: ProgressMonitor takes too long to display in Sun's ProgressMonitorDemo
- Next by thread: Need help with a viewToModel() problem in a JTable
- Index(es):
Relevant Pages
|
|