• Post Reply Bookmark Topic Watch Topic
  • New Topic

Bring a JDialog to the front

 
Barry Brashear
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to bring a dialog to the front if the application to which
that dialog belongs is not currently showing on the desktop? Say you have
an application running, but you currently have Word showing, is there a
way to bring the dialog in front of Word, when it opens?

Thanks.
 
sammaiah kyatham
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just change the parent of the dialog.

Thanks
sam
 
Barry Brashear
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Change it to what?

Thanks.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Barry Brashear:
Is there a way to bring a dialog to the front if the application to which
that dialog belongs is not currently showing on the desktop? Say you have
an application running, but you currently have Word showing, is there a
way to bring the dialog in front of Word, when it opens?

Thanks.


Hmm, I am not sure why a newly opened dialog wouldn't just open in front to begin with.

You need to feed the parent container into the JDialog constructor when you create it so that it knows what container to be modal of.
[ July 26, 2006: Message edited by: Gregg Bolinger ]
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Call setAlwaysOnTop(true) for your dialog.

This could be platform dependent, but it works on my Win2000 machine at work.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!