Solved

Modal dialog stops method finishing.

Posted on 2007-04-10
5
168 Views
Last Modified: 2010-03-31
Hi,

I'm creating a JDialog that is modal, however it seems that anything after the setVisible(true) prevents the rest of the method finishing. I'm populating a list box, but would like to do it once the dialog is visible (so that error messages appear more in connection with what is displayed), but the function that populates the list box does not get called after the setVisible(true). Possible work arounds?

Thanks,
Uni
0
Comment
Question by:Unimatrix_001
  • 3
  • 2
5 Comments
 
LVL 24

Expert Comment

by:sciuriware
ID: 18887594
The 'setVisible()' hands control over to the dialog until the dialog code say's 'setVisible(false)'.
Then, and no earlier, your method continues.
In between only the dialog buttons can put it to work.
Usually the constructor of a dialog takes up all the data.
I presume the ListBox is displayed in the dialog?
Then do the buildup entirely in the dialog's constructor.

;JOOP!
0
 
LVL 3

Author Comment

by:Unimatrix_001
ID: 18887641
"I presume the ListBox is displayed in the dialog?"
Correct.

"Then do the buildup entirely in the dialog's constructor."
The problem with reading in the data before setVisible(true) is called, is that if there is a problem a message box is shown, but it would appear before the dialog is shown. So the message box appears disconnected from the contents of the dialog box.

Is there anyway to get the readData function called inbetween the dialog being shown and control being passed over to the buttons?
0
 
LVL 24

Accepted Solution

by:
sciuriware earned 500 total points
ID: 18887669
I don't see the problem to pop the messagebox from the constructor, where the data is available.
There is a way to 'activate' code in a dialog after the setvisible, by starting a 1-shot timer
from the constructor with a delay of 1 mSec, but maybe that's not what you want.


;JOOP!
0
 
LVL 3

Author Comment

by:Unimatrix_001
ID: 18887675
Very well. I'll leave it be. :)
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 18887680
:-)
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to implement Singleton Design Pattern in Java.

810 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