Could you please review the following fix for the bug.
In the fix for JDK-8166772 it was deliberately implemented that the
touch keyboard is shown only on "MouseEvent.MOUSE_RELEASED" event and is
hidden on "FocusEvent.FOCUS_LOST" event.
The reason of the bug is the fact that, when the touch keyboard is
already shown for one text component and a user touches another text
component, then the following 2 events occur in the presented order:
1. "MouseEvent.MOUSE_RELEASED" event arrives. The touch keyboard is
shown for the new text component.
2. "FocusEvent.FOCUS_LOST" event arrives for the previous text
component. The touch keyboard shown for the new text component becomes
The fix allows not to hide the touch keyboard during processing of
"FocusEvent.FOCUS_LOST" event, if the touch keyboard has just been
shown, as a result of processing of "MouseEvent.MOUSE_RELEASED" event,
for the component which gets focus "FocusEvent.getOppositeComponent()".