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

Entering accents in a textfield on a JFXPanel produces NPE

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      linux_ubuntu

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_131"
      Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
      Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Linux o 4.4.0-83-generic #106-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux


      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Germany keyboard layout

      A DESCRIPTION OF THE PROBLEM :
      I can't enter an accented character like à. instead, the application produces an NPE. Other non accented characters work. And also things like §, $, % etc work correctly.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Start the application and enter an accented character, e.g. typing SHIFT + ` +a



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The accented character appears correctly in the textfield
      ACTUAL -
      The character does not appear and an NPE is thrown.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
      at javafx.embed.swing.JFXPanel.sendInputMethodEventToFX(JFXPanel.java:647)
      at javafx.embed.swing.JFXPanel.processInputMethodEvent(JFXPanel.java:635)
      at java.awt.Component.processEvent(Component.java:6315)
      at java.awt.Container.processEvent(Container.java:2236)
      at java.awt.Component.dispatchEventImpl(Component.java:4889)
      at java.awt.Container.dispatchEventImpl(Container.java:2294)
      at java.awt.Component.dispatchEvent(Component.java:4711)
      at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
      at java.awt.EventQueue.access$500(EventQueue.java:97)
      at java.awt.EventQueue$3.run(EventQueue.java:709)
      at java.awt.EventQueue$3.run(EventQueue.java:703)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
      at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
      at java.awt.EventQueue$4.run(EventQueue.java:731)
      at java.awt.EventQueue$4.run(EventQueue.java:729)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)



      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package application;

      import javax.swing.JFrame;
      import javax.swing.SwingUtilities;

      import javafx.application.Platform;
      import javafx.embed.swing.JFXPanel;
      import javafx.scene.Group;
      import javafx.scene.Scene;
      import javafx.scene.control.TextField;
      import javafx.scene.paint.Color;

      public class Test {

          private static void initAndShowGUI() {
              // This method is invoked on the EDT thread
              JFrame frame = new JFrame("Swing and JavaFX");
              final JFXPanel fxPanel = new JFXPanel();
              frame.add(fxPanel);
              frame.setSize(300, 200);
              frame.setVisible(true);
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

              Platform.runLater(new Runnable() {

                  @Override
                  public void run() {
                      initFX(fxPanel);
                  }
              });
          }

          private static void initFX(JFXPanel fxPanel) {
              // This method is invoked on the JavaFX thread
              Scene scene = createScene();
              fxPanel.setScene(scene);
          }

          private static Scene createScene() {
              Group root = new Group();
              Scene scene = new Scene(root, Color.ALICEBLUE);

              TextField tf = new TextField();
             
              root.getChildren().add(tf);

              return (scene);
          }

          public static void main(String[] args) {
              SwingUtilities.invokeLater(new Runnable() {

                  @Override
                  public void run() {
                      initAndShowGUI();
                  }
              });
          }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Type the accented character elsewhere, copy it, and paste it into the field

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                psadhukhan Prasanta Sadhukhan
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: