Meaningless Drivel is fun!
The moose likes Swing / AWT / SWT and the fly likes Window to top Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Window to top" Watch "Window to top" New topic

Window to top

Chris Hurst
Ranch Hand

Joined: Oct 26, 2003
Posts: 443

I need a Windows/Java/Swing app that can jump to being top window at the click of a button even when not focused\activated\foreground , iconfied etc in Windows e.g. you hit a special big red button and my applet kicks in regardless of what else your doing.

I've JNI'ed a hook which works fine to get all keyboard events (everything works 100% key event wise) but currently my only way to get the target window to be top window all time time is if I iconfiy / zoom i.e.

This again works for everything but I was hoping to do a more move to front type functionality, if the window is already on screen but perhaps obscured (or partially obscured) move it to the top and do nothing if it is top.

I tried stuff like this but if the window is obscured by another (non swing window) it stays that way (unlike my first attempt above)

(I don't do that much Swing so be gentle)

If this is just not possible, is there a way I can detect that the Window is not obscured i.e. Foreground (that way I can turn off the zoom when not needed :-) ) other than using JNI (which at the moment I'll end up doing :-( )

"Eagles may soar but weasels don't get sucked into jet engines" SCJP 1.6, SCWCD 1.4, SCJD 1.5,SCBCD 5
I agree. Here's the link:
subject: Window to top
It's not a secret anymore!