3 Replies - 1860 Views - Last Post: 03 December 2011 - 02:36 PM Rate Topic: -----

#1 bennyhay  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 10-November 11

Using progress bars with buffered input and output streams

Posted 03 December 2011 - 02:23 PM

I am trying to use a progress monitor to monitor the read speed of a file. i have the code i am using currently. i am unsure of what to do to make the progress bar show. any help is much appreciated


InputStream bis = new BufferedInputStream(new ProgressMonitorInputStream(parentComponent,"Reading " + Filename, new FileInputStream(myFile)));

Is This A Good Question/Topic? 0
  • +

Replies To: Using progress bars with buffered input and output streams

#2 exiles.prx  Icon User is offline

  • D.I.C Head

Reputation: 65
  • View blog
  • Posts: 241
  • Joined: 22-November 10

Re: Using progress bars with buffered input and output streams

Posted 03 December 2011 - 02:29 PM

Progress Bar Tutorial is a good tutorial, as well as How to use Progress Bars.

This post has been edited by exiles.prx: 03 December 2011 - 02:30 PM

Was This Post Helpful? 1
  • +
  • -

#3 bennyhay  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 10-November 11

Re: Using progress bars with buffered input and output streams

Posted 03 December 2011 - 02:31 PM

i think i need to start a new thread to "paint" the object, but can someone explain how to do this?? thanks
Was This Post Helpful? 0
  • +
  • -

#4 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8343
  • View blog
  • Posts: 31,890
  • Joined: 06-March 08

Re: Using progress bars with buffered input and output streams

Posted 03 December 2011 - 02:36 PM

You don't need a separate thread
The File has a size() method so you can get the size of the file in bytes
then in a loop if you read from file 1000 bytes at a time compute the percentage done and update your progress bar accordingly. It will automatically repaint itself
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1