Results 1 to 7 of 7
- 02-22-2011, 01:03 PM #1
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:
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.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... }
What am I doing wrong?
-
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
- 02-22-2011, 02:12 PM #3
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!
- 02-22-2011, 02:40 PM #5
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
-
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.
- 02-22-2011, 03:18 PM #7
Similar Threads
-
Popup JFrame
By BariMutation in forum New To JavaReplies: 3Last Post: 12-04-2010, 12:12 PM -
popup menu
By jperson in forum New To JavaReplies: 3Last Post: 09-18-2010, 01:44 PM -
SWT balloon Popup
By prasannakum in forum SWT / JFaceReplies: 0Last Post: 04-21-2010, 09:58 AM -
JTree Popup
By jiexx in forum New To JavaReplies: 1Last Post: 03-24-2009, 01:58 AM -
Popup in Java
By fernando in forum New To JavaReplies: 1Last Post: 08-07-2007, 06:55 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks