FullScreen (Exclusive) Swing Components Fail to Receive Keyboard Input on Java 7 on Mac OS X (Mountain) Lion
ebailey at acuitus.com
Fri Nov 2 14:14:59 PDT 2012
Wow, thanks for the response! At least in my test example, this indeed restores keyboard input. I initially though I might have to resort to invokeLaters on the visibility calls, but immediately after works fine:
I have yet to file a bug. Would you like one based on this latest information?
Also, I'll be checking my larger app for functionality in a few minutes and will report back.
On Nov 2, 2012, at 1:36 PM, Leonid Romanov wrote:
> Well, although I'm not 100% sure yet, but it looks like when we enter full screen some other window becomes the first responder, hence the beep. Could you please try the following workaround: after calling setFullScreenWindow() on a frame, call setVisible(false) followed by setVisible(true). This, in theory, should restore the correct first responder.
> On Nov 2, 2012, at 10:37 PM, Leonid Romanov <leonid.romanov at oracle.com> wrote:
>> Confirming that this issue is reproducible on my Mac as well. Have you filled the bug yet?
>> On Nov 1, 2012, at 11:26 PM, Eric Bailey <ebailey at acuitus.com> wrote:
>>> 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):
>>> 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
More information about the macosx-port-dev