FullScreen (Exclusive) Swing Components Fail to Receive Keyboard Input on Java 7 on Mac OS X (Mountain) Lion
Eric Bailey
ebailey at acuitus.com
Thu Nov 1 12:26:00 PDT 2012
Hello,
My company has a Swing application that needs to run in both a windowed context and in a fullscreen, kiosk-like mode.
This application has worked fine for years on OS X, most recently targeting Java 6. We've been looking to move to Java 7 and to incorporate JavaFX elements, driving us to do compatibility testing with the latest Mountain Lion release (10.8.2 Supplemental) and Oracle's JDK 7u9.
Unfortunately, we noticed a glaring issue while in fullscreen mode: mouse movement and clicks work fine, but keyboard input is not delivered to the components. Tab also does not work for focus traversal, though the focus subsystem appears to work properly according to FocusListeners and the KeyboardFocusManager. Most key presses produce a system alert beep in response, though registered KeyListeners and key bindings receive no events.
I have a detailed issue and focused sample code on StackOverflow (I didn't want to burden the message with the 240 line sample):
http://stackoverflow.com/questions/13064607/fullscreen-swing-components-fail-to-receive-keyboard-input-on-java-7-on-mac-os-x
Digging deeper, we identified that the issue was introduced with 7u6, when JavaFX began its inclusion in the mainline distribution. It remains in 7u7 and 7u9, and it affects both Lion 10.7 and Mountain Lion 10.8. A coworker attributes this to a switch from an AWTView to a NSWindow in 7u6 as the backing for the fullscreen window.
I'll be filing an issue with Oracle soon, but I was hoping to hear of possible workarounds in the interim.
One alternative approach I was pursuing was incorporating com.apple.eawt.FullScreenUtilities. This option has been included in my sample code, but I have found limited kiosking capabilities. In particular, I'm hoping to eliminate access to Command-Tab app switching, Mission Control, and Launch Pad, effectively locking the user into my application (it's an education setting). Unfortunately, the prevailing suggestions regarding disabling the Dock (which is responsible for those listed capabilities) revealed that the Dock also handles fullscreen apps, rendering the FullScreenUtilities calls inoperable.
All input is greatly appreciated.
Thank you,
Eric Bailey
Director, Content Engineering
Acuitus
More information about the macosx-port-dev
mailing list