Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

setAlwaysOnTop  RSS feed

 
Willem Kunkels
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have a Swing application (a JFrame) which uses another JFrame to display information on a product.

I have set the property for this second JFrame to 'always on top'. It almost has the desired effect: if the main JFrame is active, the additional JFrame is visible too (as 'always on top' suggests). However, if I now open another window (like a browser window), the second frame shows on top of that too. What I am really looking for is for the 'always on top' to work within my application. I have tried to implement the windowActivated / windowActivated listeners to implement this, but that does not have the desired effect.

Is there such a thing as 'always on top within application' or has someone found a solution to handle such a situation?

Cheers,
Willem
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try using a modal dialog instead of the second JFrame.
Check out JOptionPane@showXXXDialog() for various ready made options
 
Willem Kunkels
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Maneesh, but I use a JFrame for a good reason, one of them being able to minimize it so that it shows on the taskbar (which is not possible with a dialog).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!