Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDiaog window remain always on top

 
Priya Lavti
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a JDialog window which remain always on top even if I select the previous window.

what is the change i need to do so that the JDialog window goes in back when i select parent window?
Or do i need to use something else than JDialog?

Thanks!
 
santhosh varala kumar
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pinks M wrote:Hi,

I have a JDialog window which remain always on top even if I select the previous window.

what is the change i need to do so that the JDialog window goes in back when i select parent window?
Or do i need to use something else than JDialog?

Thanks!


Just use dialog.setModal(false);
 
Priya Lavti
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, I am doing the same.
But even then the dialog appears on top of parent window after selecting the parent window.

The JDiaog window is still shown on top of parent window but is inactive state (i.e. not selected/focused). It hinders the view of parent window when doing any operation on parent window.

 
santhosh varala kumar
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Priya Lavti wrote:yes, I am doing the same.
But even then the dialog appears on top of parent window after selecting the parent window.

The JDiaog window is still shown on top of parent window but is inactive state (i.e. not selected/focused). It hinders the view of parent window when doing any operation on parent window.



provide the code
 
Samuel March
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do not use a modal JDialog.
Also declare a separate JFrame to bind to the JDialog.
 
Rok Ć telcer
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

JDialog is by default always non-modal ... if not explicitly specified otherwise:
- via constructor --> boolean flag
- or via method call setModal(boolean)


Regards,
Rok
 
Samuel March
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could just pop a new JFrame and that will.
 
sooraj sukumaran
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I have the same problem.if i set modality it makes my application inactive.please suggest me
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic