Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Swing / AWT / SWT and the fly likes Always stay on top (JFrame) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Always stay on top (JFrame)" Watch "Always stay on top (JFrame)" New topic
Author

Always stay on top (JFrame)

Stuart Geipel
Greenhorn

Joined: Jun 27, 2009
Posts: 10
I'm aware of Window.setAlwaysOnTop(true). And this does what it's meant to- it stays on top even when you click away. The problem is, I want to have it so that the close buttons and shadow of the window don't fade as if you've lost focus whenever you click away. How can I do this?
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2180
    
    7
It fades because it no longer has focus and is unable to accepts events until you click back on it again.

This is proper behaviour and would be extremely confusing for the user to have two windows with selected title bars because both would look like they could accept events.
Stuart Geipel
Greenhorn

Joined: Jun 27, 2009
Posts: 10
No, I don't want both to be focused, I only want the one window to have focus, and have it not change to my my other window.

Could I create a listener that listens to the focus of the other window, so that whenever it receives focus it hands it back to the stay on top window?
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2180
    
    7
Sounds like you want to use the following on the child window:

Stuart Geipel
Greenhorn

Joined: Jun 27, 2009
Posts: 10
Awesome! Thanks so much!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Always stay on top (JFrame)