Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ProgressMonitor problem

 
D Preethi
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have a use case in which I want to display a progress bar indicating the downloaded number of bytes. I decided to go for ProgressMonitor since it gives me options to cancel the download, and also to periodically display the bytes downloaded.

But I read in the java doc of ProgressMonitor that the progress bar doesnt always show up. I tried setting setMillisToPopup(0) and also setMillisToDecideToPopup(0). Currently, I am seeing that if the download does not take a long time, then the progress bar doesnt show up, inspite of setting both setMillisToDecideToPopup and setMillisToPopup to 0 milliseconds. Is this expected behavior?

Also, is this a right use case to use ProgressMonitor? Can someone please guide me in this?


Thanks in advance,
Preethi
 
Maneesh Godbole
Saloon Keeper
Posts: 11185
15
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like a threading problem to me. Without seeing your code, it is not possible to figure out what the problem is.
Does the progress bar and download operation happen on the same thread?
Have you looked at http://java.sun.com/docs/books/tutorial/uiswing/components/progress.html
 
D Preethi
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No actually, the downloading part is a 3rd party API which I am trying to use in my code. I just needed to attach a progress bar in my code to indicate the download progress. Is my approach wrong?
 
Maneesh Godbole
Saloon Keeper
Posts: 11185
15
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you go through the link I had provided to figure out how to fix the threading issue?
 
D Preethi
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I did... actually, I have a constraint of using java 5.0 only... and the link seems to talk about threads with respect to progress bars only, and not progress monitor, so, I guess I am on wrong track.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic