Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Always stay on top (JFrame)

 
Stuart Geipel
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2533
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2533
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like you want to use the following on the child window:

 
Stuart Geipel
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Awesome! Thanks so much!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic