Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Modal dialog stops method finishing.

Posted on 2007-04-10
5
Medium Priority
?
174 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
[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
  • 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 2000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
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…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

609 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