modal/non-modal dialog boxes

I am trying to create a JDialog box that has a progress bar, to show the progress of an operation on the window below.  If I create a modal dialog box, The box shows up correctly, but has taken processing away from the window below, which cannot complete its operation until the window is closed.

On the other hand, if I create a non-modal window, the dialog is displayed only showing the title correctly, with a blank content area.  When it is done this way, the operation completes, but the progress bar cannot be seen.

The code in the actionListener for the underlying window that is supposed to display the dialog looks something like:
QSGBS.waitDialog = new GUI.WaitDialog(new java.awt.Frame(), false, "Please Wait While Searching for Bookings...");
QSGBS.waitDialog.show();
QSGBS.monthlyPlanner.displayMonthlyBookings(cal); //operation on underlying window
QSGBS.waitDialog.dispose();

Can anybody help??
LVL 1
steeksAsked:
Who is Participating?
 
kotanCommented:
You can use Progress monitor to pop up dialog box with progress bar.

http://java.sun.com/docs/books/tutorial/uiswing/components/progress.html#monitors
0
 
yongsingCommented:
You can use the javax.swing.Timer class to do that. See tutorial:

http://java.sun.com/docs/books/tutorial/uiswing/misc/timer.html
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
steeksAuthor Commented:
I tried to use the progress monitor, but the same thing happened.

What I'm actually doing is querying a database, to display the results in a monthly calender.  The program initially searches the database for bookings, and the progress bar works fine.  When a button on the calendar is pressed to change year/month, the program then searches for bookings again.  For some strange reason, when it goes to do this, you get a blank progress dialog that shows nothing.
0
 
objectsCommented:
You need to handle your processing and your dialog in seperate threads. As you've noticed and stated it's pointless performing your processing AFTER your dialog has been closed.
0
 
objectsCommented:
Additionally you should not be doing lengthy processing in the event dispatch thread. This will cause your gui to freeze until the processing is complete.
This is why you're getting blank windows, as no repainting can happen until your processing is completed.
0
All Courses

From novice to tech pro — start learning today.