How to stop a new window from taking focus
Hello,
I have an application that brings up alerts when an event occurs. The alerts are actually toasts (similar to msn messenger alerts when someone comes online).
My problem is that if I am working on another application, for example notepad, when the alert comes up, it takes the focus away from notepad, which, needless to say, is quite annoying.
Does anybody know how to bring up a new window without letting it take focus?
Thank you very much for your time.
Adrian Basheer
Well, yes, that sounds like the right thing to do. However, I don't know how to do that with Java.
What I need to do is:
When my new Java window obtains focus, I need to set focus to the last System window that had it. Where, the last system window may not be a Java application (It could be notepad, MS Word...)
Thanks a lot,
Adrian.
> When my new Java window obtains focus, I need to set
> focus to the last System window that had it. Where,
> the last system window may not be a Java application
> (It could be notepad, MS Word...)
OH!! Well...I have no idea how to do that. I doubt it's possible as well. What you want to do is take control over the OS and the OS typically likes to be in control!
Hi again,
I have found out that the problem has to do with calling setVisible( true ). The solution to my problem would be the ability to call setFocuse(true) and not let the window take focus at the same time.
A more detailed explanation of the scenario follows:
The scenario is that my application's main window is hidden, but as it is working in the background, I need so show a message to a user when a certain event happens. This is very much like the status messages in msn messenger.
If I create a new message window and the main application is invisible, the message window will also be invisible. Once I call setVisible( true ) on it, it becomes visible, however it takes focus from anything else.
WIthout the call to setVisible(true), the scenario only works if the main application window is visible, and in this case, the message window does not request focus.
Thanks,
Adrian.