• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

setAlwaysOnTop

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
What I don't understand is how they changed the earth's orbit to fit the metric calendar. Tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic