Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDialog in front when JFrame on top?

 
Tom Rodrigo
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Tom Rodrigo
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic