Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / May 2006

Tip: Looking for answers? Try searching our database.

setVisible on a JWindow steals focus from other apps?

Thread view: 
Trademark - 22 Feb 2006 23:12 GMT
Hey all. I need to popup a window without the user necessarily noticing
it immediately. I'm using a technique involving a JWindow that starts
mostly offscreen and slides in to reveal information.

The problem is that when I surface the JWindow with setVisible(true),
the focus is stolen away from other applications, alerting the user too
early and just being annoying. Anyone have any advice on how to fix
this?

--TM
opalpa@gmail.com opalinski from opalpaweb - 23 Feb 2006 02:30 GMT
What happens when you call toBack() before calling setVisible(true);

http://java.sun.com/j2se/1.3/docs/api/java/awt/Window.html#toBack()

Opalinski
opalpa@gmail.com
http://www.geocities.com/opalpaweb/
Trademark - 23 Feb 2006 04:34 GMT
Still the same behavior. Whatever application had the focus looses it.
:-(
Bill Joy - 23 Feb 2006 04:45 GMT
Just subclass JWindow and override the toFront() method so it does nothing.

> Hey all. I need to popup a window without the user necessarily noticing
> it immediately. I'm using a technique involving a JWindow that starts
[quoted text clipped - 6 lines]
>
> --TM
Trademark - 23 Feb 2006 17:12 GMT
Hmm. Tried that, and it doesn't seem to help. The real problem is that
I need these windows to be always on top. But when calling
setVisible(true) on something with a non-zero size that has the
setAlwaysOnTop attribute set, I can't seem to avoid the focus stealing.

Thanks for the helpful suggestions so far! Any other thoughts about how
I could acheive a similar effect?

--TM
opalpa@gmail.com opalinski from opalpaweb - 23 Feb 2006 19:43 GMT
I'm curious if you will be able to do this in Microsoft Windows.  Post
here is you find something.  Gaining focus and being activated appear
to be windowing system dependent.

Good luck
Opalinski
opalpa@gmail.com
http://www.geocities.com/opalpaweb/
zero - 23 Feb 2006 20:51 GMT
> I'm curious if you will be able to do this in Microsoft Windows.  Post
> here is you find something.  Gaining focus and being activated appear
[quoted text clipped - 4 lines]
> opalpa@gmail.com
> http://www.geocities.com/opalpaweb/

I have seen "always on top" windows pop up without getting focus under MS
Windows - although rarely, and I don't think any of them were programmed
that way on purpose - more likely it was a side-effect or even
nonreproducible, "random" behaviour.  I think it must be possible though,
but it may indeed be OS dependent.
Richard Wilson - 22 May 2006 09:32 GMT
> I'm curious if you will be able to do this in Microsoft Windows.  Post
> here is you find something.  Gaining focus and being activated appear
> to be windowing system dependent.

Yes, SetWindowPos with SWP_NOACTIVATE and HWND_TOP or HWND_TOPMOST.

Richard
opalpa@gmail.com opalinski from opalpaweb - 25 Feb 2006 15:32 GMT
Yesterday/today I wanted window that came up toFront and did not steal
focus.  There is method setFocusableWindowState(boolean fs) and I used
it before validate and pack and I get behaviour I was looking for.  The
focus stays in app it was in before calling setVisible.   The property
stayed after calls to setVisible(false) and setVisible(true).

Opalinski
opalpa@gmail.com
http://www.geocities.com/opalpaweb/


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.