JDialog always on top on java 1.4

Hello!

I'm working on a GUI now and I wanted to know if you could help me with this.

I've got one main window and, when pressing a button a JDialog (smaller than the previous window) appears in the middle of the window.

I want that JDialog to stay always on top until another button's pressed, but if I click on the main window while the dialog is opened, then the whole main window becomes visible and active, and the JDialog dissapears (sent to back).

I've read something about 'setAlwaysOnTop', but that's only for JDK1.5 and I'm using ('cause I have to) 1.4.

What can I do?

Thanx in advice!

[646 byte] By [chavaflyfreea] at [2007-11-27 3:09:07]
# 1

I've read in this and other forums about the 'setModal(true)'.

I've got two problems with that:

1) Is there a way not to play the standard Windows' error sound (that sort of a 'clonk') when clicking the main frame while the dialog is active?

2) My JDialog object is not really a JDialog. I've created myDialog class extending JDialog, and (as I'm a newbie) I don't know how to set a parent for my 'myDialog' object. So there's that issue about alt-tab only showing the dialog instead of both... How can I set the parent if my class look like this:

class myDialog extends JDialog {

...

public myDialog ( ) {

...

}

}

Thanks again

Message was edited by:

chavaflyfree

chavaflyfreea at 2007-7-12 3:57:46 > top of Java-index,Desktop,Core GUI APIs...
# 2
1) You don't need to use a modal dialog if you want the user to be able to access the JFrame and the JDialog at the same time.2) You class need to have a constructor that accepts a JFrame as the owner. Then you just invoke super(frame).
camickra at 2007-7-12 3:57:47 > top of Java-index,Desktop,Core GUI APIs...
# 3

1) That's not what I want to do. I only want to access to the JDialog. Just wanted to know if there's a way to deactivate the 'clonk' error sound when clicking on the main frame.

2) Ok, I thought 'super' had to be called like 'this.super(frame)' (Did I said I'm a newbie? ;) ). Now it's ok. Thank you!

chavaflyfreea at 2007-7-12 3:57:47 > top of Java-index,Desktop,Core GUI APIs...