Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

ProgressMonitor problem

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 11445
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 11445
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic