• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 488
  • Last Modified:

JDialog always on top

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
izi13
Asked:
izi13
1 Solution
 
objectsCommented:
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
 
girionisCommented:
 ...And another possible solution can be found here: http://home-1.tiscali.nl/~bmc88/java/sbook/0115.html

  Hope it helps.
0
 
heyhey_Commented:
public JDialog(Frame owner, boolean modal)
Creates a modal or non-modal dialog without a title and with the specified owner frame.
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
gsvikramCommented:
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
 
girionisCommented:
 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
 
objectsCommented:
And what I said, and also incorrect as a nonmodal dialog will also stay on top.
0
 
izi13Author Commented:
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
 
objectsCommented:
I don't understand what you mean, but as long as your happy :-)
0
 
girionisCommented:
 izi13 thanks for the points. I am glad I've helped :-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now