File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes ProgressMonitor problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "ProgressMonitor problem" Watch "ProgressMonitor problem" New topic
Author

ProgressMonitor problem

D Preethi
Ranch Hand

Joined: May 24, 2008
Posts: 68
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

Joined: Jul 26, 2007
Posts: 10167
    
    8

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


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
D Preethi
Ranch Hand

Joined: May 24, 2008
Posts: 68
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

Joined: Jul 26, 2007
Posts: 10167
    
    8

Did you go through the link I had provided to figure out how to fix the threading issue?
D Preethi
Ranch Hand

Joined: May 24, 2008
Posts: 68
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.
 
wood burning stoves
 
subject: ProgressMonitor problem
 
Similar Threads
Java swing background execution
How to put ProgressMonitor bar while saving a file
Progress bar on IE6
Where's my ProgressMonitor content?
Servlet Download Problem