Solved

JDialog always on top

Posted on 2002-05-28
9
408 Views
Last Modified: 2011-04-14
Hi,
how can I make my dialog (derived from JDialog) to be always on the top ?
What I want to do - I have an GUI App (programmed using Java Swing). In an separate thread I start a time consuming job. Now I would like to show something like modal dialog which shows the progress. So the main application window cannot be accessed until the thread stops or a button is pressed in the progress window. How can it be done ?

Thanx a lot.
Izi
0
Comment
Question by:izi13
9 Comments
 
LVL 92

Expert Comment

by:objects
ID: 7038852
Just make your GUI's frame the dialog parent (passed to the ctor).
A JDialog will always stay on top of it's parent frame.
0
 
LVL 35

Accepted Solution

by:
girionis earned 100 total points
ID: 7038865
 ...And another possible solution can be found here: http://home-1.tiscali.nl/~bmc88/java/sbook/0115.html

  Hope it helps.
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 7038867
public JDialog(Frame owner, boolean modal)
Creates a modal or non-modal dialog without a title and with the specified owner frame.
0
 

Expert Comment

by:gsvikram
ID: 7039543
There is two types of Dialog boxes.

Modal and non-modal. A modal is  your required type.
Please the check the following Constructors:-

JDailog(Frame parent,true);
This will create a Modal(all ways on top) Dialog box.

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 35

Expert Comment

by:girionis
ID: 7039593
 gsvikram

1) Please do not propose answers as this locks the question to other experts and it is more difficult to answer. Post comments instead as comment can still be accepted as answers.

2) Your answer is exactly what heyhey said.
0
 
LVL 92

Expert Comment

by:objects
ID: 7040536
And what I said, and also incorrect as a nonmodal dialog will also stay on top.
0
 

Author Comment

by:izi13
ID: 7041175
The most appropriate answer for me is the comment fom girionis, because I create/show the dialog in my main frame's processEvent method and I don't want it to be blocked by the dialog.
Thanx to all anyway ...
Izi
0
 
LVL 92

Expert Comment

by:objects
ID: 7041197
I don't understand what you mean, but as long as your happy :-)
0
 
LVL 35

Expert Comment

by:girionis
ID: 7041201
 izi13 thanks for the points. I am glad I've helped :-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
groupNoAdj 7 86
Requested array size exceeds VM limit 3 84
Problem to start Neon 20 87
nextBoolean(double p) for Random class 3 35
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…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

895 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now