This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Where's my ProgressMonitor content? 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 "Where Watch "Where New topic
Author

Where's my ProgressMonitor content?

Bob Dobalina
Ranch Hand

Joined: May 24, 2001
Posts: 53

A little help please... I'm kinda stuck.
I've got a Swing application running in a JFrame that allows a user to select some content from a data source, then click a button to extract the data. The extraction can take a few minutes, so I want to put up a progress bar. I already used a ProgressMonitor to display the application's status as it loads, and it displays fine, but when I try to create a new ProgressMonitor to show the status of the extraction, it doesn't draw correctly. The window shows up, and I can select it and drag it, but there's no content in the window! It's just a gray box...
I thought "Ok, this ProgressMonitor class must suck, I'll write my own damn one." So I did, based around a JDialog, and used one to display the progress of the application as it loads, and it works like a 'beaut. Then I tried the same thing during the extraction process, and none of the components I added to the dialog show up! Again, just another gray box...
Anybody have any ideas? I'm stumped...
-tim
Javaoops
Ranch Hand

Joined: Jun 21, 2001
Posts: 57
check with URL - Progress Bar
http://java.sun.com/docs/books/tutorial/uiswing/components/progress.html
Bob Dobalina
Ranch Hand

Joined: May 24, 2001
Posts: 53

Thanks for the link, but I've already read that page and there's not much to help me there, except that I can't re-use a ProgressMonitor, something that I had initially tried to do, but changed my code later to remove.
Anybody else have any ideas?
thanks,
-tim
Micah Wedemeyer
Ranch Hand

Joined: Jun 11, 2001
Posts: 68
I too have had some crazy problems with JProgressMonitor. I have one that pops up sometimes and stays invisible other times. There seems to be no determining when it will decide to display. If anyone has any knowledge about this, I'd be happy to hear it.
Micah
Bob Dobalina
Ranch Hand

Joined: May 24, 2001
Posts: 53

I think my problem was due to the process that I was trying to monitor. It was very system intensive and wasn't something that I could put in a thread and have pause every now and again... so it basically just chugged along and killed my app until it was done...
Micah, have you tried setting these methods?
monitor.setMillisToDecideToPopup(0);
monitor.setMillisToPopup(0);
That might just force it to pop up when you want it to, and not when it wants to...
-tim
Bob Dobalina
Ranch Hand

Joined: May 24, 2001
Posts: 53

In the off chance anyone still cares... I've got it (mostly) working. The solution is kinda convoluted, but it works.
Basically, I had to take the process of exporting the various files, and encapsulate the entire thing into a separate object, which uses a SwingWorker, which just creates an instance of an internal, private class that does the actual exporting of all the docs.
On the Swing side of things, I created a timer to regularly check the progress of the other class I created, and inside that timer I update the ProgressMonitor's note, progress, etc.
This works, but now I'm having a new problem with the ProgressMonitor. When it initially displays it doesn't have room for the "note" label. It then adds the label, shifting the Cancel button down so that only half of it is visible. This happens regardless of whether I construct it like this:
gPM = new ProgressMonitor(gFrame, "Message", "Note", 0, (size * 10));
or like this:
gPM = new ProgressMonitor(gFrame, "Message", "", 0, (size * 10));
gPM.setNote("Note");
Anybody have any ideas?
-tim
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Where's my ProgressMonitor content?
 
Similar Threads
Problem with progressMonitor
ProgressMonitor problem
1st question with app
Progress of zipping of folder on ProgressMonitor??
Extending thread class