This is an offshoot of bugid 4503980. This description is taken from the
Evaluation of that bug.
Use the Split-Pane demo in Swingset2. I assume this is all in
point-to-focus mode.
1. Click in one of the textfields in the demo.
2. Click on an external window (another app) to change focus.
3. Alt-tab to give focus back to the Swingset
The textfield will not have focus.
However, you can give focus to the textfield by clicking in it.
Below is the evaluation for Merlin by ###@###.###, tested with Merlin b78
In native code we listen only for one kind of Focus event - one with mode == NotifyNormal. When one uses special key sequences handled by WM which make windows focused/unfocused WM sends different kinds of Focus events (for example on my IceWM I receive FocusOut NotifyGrab, then NotifyWhileGrabbed when I switch out of application, then FocusIn NotifyWhileGrabbed, NotifyUngrab when I switch back). We skip all this events in awt_MToolit.c:processOneEvent.
If you have Java windows focused and click with mouse to another window on desktop then Java receives FocusOut NotifyNormal which we process and CLEAR focus. Therefor when you switch back using key sequence, and we doestn't receive any Focus events we listen to, we doesn't restore focus and frame looks active and not having focus. To restore focus you can just click on the component you want to make it focused.
Workaround: ###@###.###
Don't mix mouse and keyboard application switch, if you switched out of Java by mouse return back also by mouse. If you switched out of Java by keyboard, you can switch back either by keyboard or mouse.