Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Window.setAlwaysOnTop() functionality without hiding other apps?

843805Jan 8 2007 — edited Jan 30 2007
Hi all,

My app starts out with one JFrame, and the user has the ability to create more JFrames. I'd like for those user-created JFrames to always stay on top of the original JFrame.

Now, I know I can call setAlwaysOnTop(true) on the spawned JFrames, but I don't want them to stay on top of other applications too - just on top of my original frame. Otherwise, using setAlwaysOnTop meets my needs exactly.

Trying to enforce the z-order manually doesn't work quite right, either. I can call toFront() in order from back to front when I lose/gain focus in any frame, at which point it looks fine, but if the original frame has the focus, clicking inside the frame again causes it to come to the front without any focus events being thrown. I need focus to remain in the original frame without the frame coming to the front.

As I said before, the behavior when using setAlwaysOnTop(true) in the spawned frames works great, but I just don't want those frames sitting on top of other apps as well. Any ideas or suggestions? Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 27 2007
Added on Jan 8 2007
9 comments
351 views