Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2011
    Location
    Florida
    Posts
    60
    Rep Power
    0

    Default Can't get popup for ProgressMonitorInputStream to work

    Hi,

    I did search for ProgressMonitorInputStream and came up short. If I just didn't search properly, I apologize.

    I am trying to use ProgressMonitorInputStream to display a popup progress bar while I process an input file. The popup does display but not completely. The processing does complete and the popup goes away afterwords but during processing all the popup displays is "Processing...". There is no progress bar displayed. Just a blank while box.

    Here is the relevant code snippet:

    Java Code:
            ProgressMonitorInputStream pmonIS
                   = new ProgressMonitorInputStream(
                              mainPanel,
                              "Processing...",
                              new FileInputStream(inFile.getAbsolutePath()));
            ProgressMonitor pmon = pmonIS.getProgressMonitor();
            pmon.setMillisToPopup(250);
            InputStream inStream = new BufferedInputStream(pmonIS);
    
            int c;
            while ((c = inStream.read()) != -1)
            {
                process file...
            }
    Also I did look at the minimum and maximum size attributes (by doing a pmon.getMaximum() and pmon.getMinimum() and they are set to the byte length of the file and 0 respectively.
    What am I doing wrong?

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Please look at the Progress Monitor tutorial (it's probably better to do this first before asking the question here as it will save you much time), as the answer's there. You're blocking the monitor's thread with your stream reading. The solution -- as in the tutorial, use a SwingWorker to create a background thread.

    The tutorial: Progress Monitor

  3. #3
    Join Date
    Feb 2011
    Location
    Florida
    Posts
    60
    Rep Power
    0

    Default

    I did read that very tutorial and wrestled with it for the last couple of days. I did not notice the swingWorker bit. I don't post questions willy-nilly. I always do my own research first. Sorry if I just missed it.

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by madroadbiker View Post
    I did read that very tutorial and wrestled with it for the last couple of days. I did not notice the swingWorker bit. I don't post questions willy-nilly. I always do my own research first. Sorry if I just missed it.
    Please don't get me wrong, it doesn't bother me if you did or didn't read the tutorial, but again if you read it and understood it, then it would save you time, that's all. If you don't understand a part, then please feel free to bring a question covering the misunderstanding here.

    Best of luck!

  5. #5
    Join Date
    Feb 2011
    Location
    Florida
    Posts
    60
    Rep Power
    0

    Default

    Ok fair enough. This job is stressing me out to the breaking point :eek: I do appreciate your help. I'm going to take a sedative now :D

  6. #6
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    And there was no sarcasm meant in any of my replies, and I'm sorry if it was taken this way. I sincerely meant what I said and felt like I said what I meant.

  7. #7
    Join Date
    Feb 2011
    Location
    Florida
    Posts
    60
    Rep Power
    0

    Default

    I know and I apologize for saying that. My only excuse is the extreme stress I am under at work at the moment (see previous post).

Similar Threads

  1. Popup JFrame
    By BariMutation in forum New To Java
    Replies: 3
    Last Post: 12-04-2010, 01:12 PM
  2. popup menu
    By jperson in forum New To Java
    Replies: 3
    Last Post: 09-18-2010, 02:44 PM
  3. SWT balloon Popup
    By prasannakum in forum SWT / JFace
    Replies: 0
    Last Post: 04-21-2010, 10:58 AM
  4. JTree Popup
    By jiexx in forum New To Java
    Replies: 1
    Last Post: 03-24-2009, 02:58 AM
  5. Popup in Java
    By fernando in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 07:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •