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

JFXPanel with HtmlEditor -> input keyboard (accent) causes NullpointerException

XMLWordPrintable

    • x86_64
    • linux

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

      ADDITIONAL OS VERSION INFORMATION :
      Linux SYSTEM 4.14.3-1-ARCH #1 SMP PREEMPT Thu Nov 30 18:33:13 UTC 2017 x86_64 GNU/Linux

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Works on:
       JavaFX native application (without swing)
       Windows JRE 8.161 and 8.162

      Not works on ArchLinux:
       Java JDK/JRE 8.161/8.162
       OpenJFX 8.172

      A DESCRIPTION OF THE PROBLEM :
      I'm trying to make a HtmlEditor but crash when I'm writing an accented character.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Writing an accented character like 'à', 'è', 'á', etc


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
      at javafx.embed.swing.JFXPanel.sendInputMethodEventToFX(JFXPanel.java:681)
      at javafx.embed.swing.JFXPanel.processInputMethodEvent(JFXPanel.java:669)
      at java.awt.Component.processEvent(Component.java:6315)
      at java.awt.Container.processEvent(Container.java:2237)
      at java.awt.Component.dispatchEventImpl(Component.java:4889)
      at java.awt.Container.dispatchEventImpl(Container.java:2295)
      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 javaapplication1;

      import java.awt.BorderLayout;
      import javafx.application.Platform;
      import javafx.embed.swing.JFXPanel;
      import javafx.scene.Scene;
      import javafx.scene.layout.AnchorPane;
      import javafx.scene.web.HTMLEditor;

      /**
       *
       * @author root
       */
      public class NewJFrame extends javax.swing.JFrame {

          /**
           * Creates new form NewJFrame
           */
          public NewJFrame() {
              initComponents();
              JFXPanel fxPanel = new JFXPanel();
              add(fxPanel, BorderLayout.CENTER);
              Platform.runLater(() -> {
                  HTMLEditor htmlEditor = new HTMLEditor();
                  AnchorPane anchorPane = new AnchorPane();
                  Scene scene = new Scene(anchorPane);
                  AnchorPane.setTopAnchor(htmlEditor, 0.0);
                  AnchorPane.setRightAnchor(htmlEditor, 0.0);
                  AnchorPane.setBottomAnchor(htmlEditor, 0.0);
                  AnchorPane.setLeftAnchor(htmlEditor, 0.0);
                  fxPanel.setScene(scene);
                  anchorPane.getChildren().add(htmlEditor);
              });
          }

          /**
           * This method is called from within the constructor to initialize the form.
           * WARNING: Do NOT modify this code. The content of this method is always
           * regenerated by the Form Editor.
           */
          @SuppressWarnings("unchecked")
          // <editor-fold defaultstate="collapsed" desc="Generated Code">
          private void initComponents() {

              setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
              getContentPane().setLayout(new javax.swing.BoxLayout(getContentPane(), javax.swing.BoxLayout.LINE_AXIS));

              pack();
          }// </editor-fold>

          /**
           * @param args the command line arguments
           */
          public static void main(String args[]) {
              /* Set the Nimbus look and feel */
              //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
              /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
               * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
               */
              try {
                  for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                      if ("Nimbus".equals(info.getName())) {
                          javax.swing.UIManager.setLookAndFeel(info.getClassName());
                          break;
                      }
                  }
              } catch (ClassNotFoundException ex) {
                  java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
              } catch (InstantiationException ex) {
                  java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
              } catch (IllegalAccessException ex) {
                  java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
              } catch (javax.swing.UnsupportedLookAndFeelException ex) {
                  java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
              }
              //</editor-fold>

              /* Create and display the form */
              java.awt.EventQueue.invokeLater(new Runnable() {
                  public void run() {
                      new NewJFrame().setVisible(true);
                  }
              });
          }

          // Variables declaration - do not modify
          // End of variables declaration
      }

      ---------- END SOURCE ----------

            pmangal Priyanka Mangal (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: