aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JDialog in front when JFrame on top? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JDialog in front when JFrame on top?" Watch "JDialog in front when JFrame on top?" New topic
Author

JDialog in front when JFrame on top?

Tom Rodrigo
Greenhorn

Joined: Dec 07, 2001
Posts: 26
Hi all,
In my (one and only) JFrame it is possible to call up several JDialogs, only one or two at a time. These jdialogs are setModal(true). Now, everything works fine, but when I start another program, i.e. Windows Explorer, and I want to move back to my little application via the windows-taskbar, it's only possible to view the jframe, but not an (open) jdialog. I can only switch to the open dialog via Alt + Tabulator.
How can I automatically switch to an open JDialog whenever the JFrame is in front of the screen?
I've heard that maybe I should replace the dialogs by frames but I don't want to fill the windows-taskbar with more than one 'button' for the same application...
Any ideas?
Thanks in advance!
Tom
Rob Ross
Bartender

Joined: Jan 07, 2002
Posts: 2205
Are you passing the parent component (your JFrame) to the JDialog constructor? If so, then the dialog will always be on top of the JFrame. If you don't, then you'll have a modal dialog that's drawn behind your JFrame when you click back on the application.
I don't know of any way in java to add a JDialog to the task bar.


Rob
SCJP 1.4
Tom Rodrigo
Greenhorn

Joined: Dec 07, 2001
Posts: 26
Hey Rob,
you did it!
It took me some work to pass the JFrame to the JDialog constructor, but it works fine now...
Thanks for you help!
Tom
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JDialog in front when JFrame on top?