JDK-8130655 : OS X: keyboard input in textfield is not possible if the window contained textfield is owned by EmbeddedFrame
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 8u45,11
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • Submitted: 2015-07-07
  • Updated: 2019-03-19
  • Resolved: 2018-08-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 12 JDK 8
11.0.2Fixed 12 b14Fixed 8u202Fixed
Related Reports
Relates :  
8u45 on OS X 10.10 (and 10.9): keyboard input in an applet popup's textfield
is not possible if Java Console is not shown.

Fix Request - Justification: The patch fixes focus issue for a window owned by an embedded frame - Risk Analysis: Low. Simple changes in AWT framework for OS X platform - Testing: Client Libs regression tests. - The patch applies cleanly.

I can reproduce the problem on JDK 11 using standalone test case.

Standalone test case is provided below: import sun.awt.EmbeddedFrame; import java.awt.TextField; import java.awt.Window; public class WindowTest2 { public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException{ EmbeddedFrame embeddedFrame = (EmbeddedFrame) Class. forName("sun.lwawt.macosx.CEmbeddedFrame").newInstance(); embeddedFrame.setVisible(true); Window window = new Window(embeddedFrame); window.setSize(200, 200); window.setLocationRelativeTo(null); window.add(new TextField("Test")); window.setVisible(true); } }

According to the current implementation ���simple window���, (not Frame/Dialog) is NOT natively focusable window, (i.e. SHOULD_BECOME_KEY and SHOULD_BECOME_MAIN bits are not set for its native peer). So if ���simple window��� is owned by EmbeddedFrame it is impossible for the window to receive any key events. Possible fix: Set SHOULD_BECOME_KEY and SHOULD_BECOME_MAIN bits for simple window which is owned by EmeddedFrame.

The problem takes place on Mac OSX when window contained a text field is owned by EmbeddedFrame. If EmbeddedFrame is replaced with Frame then no problem happens.

Attached a minimal testcase for the issue, see WindowTest.zip