Solved

Modal dialog stops method finishing.

Posted on 2007-04-10
5
170 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

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…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

730 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