Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8324232

KeyEvent.getCode() is null inside JFXPanel

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • jfx23
    • jfx21
    • javafx
    • None

      macOS 14.2.1
      To reproduce:

      - run the attached program (TextField inside a JFXPanel)
      - switch input language to Arabic
      - type 'a'

      NPE gets thrown with Hebrew and Russian input.
      Japanese, French, and German seem to work except for some key strokes such as semicolon (;) in German and tick (') in French.

      (the same scenario works fine in with JTextField in a regular FX application).

      Exception in thread "JavaFX Application Thread" java.lang.NullPointerException: Cannot invoke "javafx.scene.input.KeyCode.isFunctionKey()" because the return value of "javafx.scene.input.KeyEvent.getCode()" is null
      at javafx.controls/com.sun.javafx.scene.control.behavior.TextInputControlBehavior.lambda$46(TextInputControlBehavior.java:196)
      at javafx.controls/com.sun.javafx.scene.control.behavior.TextInputControlBehavior.lambda$81(TextInputControlBehavior.java:344)
      at javafx.controls/com.sun.javafx.scene.control.inputmap.InputMap.handle(InputMap.java:274)
      at javafx.base/com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:247)
      at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
      at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:232)
      at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:189)
      at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
      at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
      at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
      at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
      at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
      at javafx.graphics/javafx.scene.Scene.processKeyEvent(Scene.java:2195)
      at javafx.graphics/javafx.scene.Scene$ScenePeerListener.keyEvent(Scene.java:2716)
      at javafx.graphics/com.sun.javafx.tk.quantum.EmbeddedScene.lambda$15(EmbeddedScene.java:376)
      at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
      at javafx.graphics/com.sun.javafx.tk.quantum.EmbeddedScene.lambda$14(EmbeddedScene.java:362)
      at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$11(PlatformImpl.java:456)
      at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
      at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$10(PlatformImpl.java:455)
      at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)

            mfox Martin Fox
            angorya Andy Goryachev
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: