Grabbing keyboard focus from native application
I need to grab keyboard focus from a native application. For example, say I am browsing some webpage in Firefox I want my JPopupMenu to suddenly become visible and grab focus.
What I am actually trying to do is implement a system-tray API and I have noticed that when a user clicks on the icon which is meant to trigger a pop-up menu, the JPopupMenu doesn't get keyboard focus because under the hood what happens is that the notification area gets keyboard focus (you clicked on it) then the popup comes up but since Java does not have focus, the popup doesn't get keyboard focus either. Obviously this is not the intended behavior so I am forced to *grab* the focus forcibly. Any ideas?