Solved

modal/non-modal dialog boxes

Posted on 2001-08-23
6
348 Views
Last Modified: 2010-08-05
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??
0
Comment
Question by:steeks
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 6

Expert Comment

by:kotan
ID: 6416524
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
 
LVL 9

Expert Comment

by:yongsing
ID: 6416531
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
 
LVL 1

Author Comment

by:steeks
ID: 6416642
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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 92

Expert Comment

by:objects
ID: 6416645
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
 
LVL 92

Expert Comment

by:objects
ID: 6416675
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
 
LVL 92

Accepted Solution

by:
objects earned 100 total points
ID: 6416679
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
spring jars download 1 68
Java string replace 11 79
Notify sent to other threads in Java 9 54
Cisco ASA: Java web start no go, asdm launcher no go 3 88
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question