title: NPEs with JavaFX's HTMLEditor
body: <p>I wrote a relatively simple test class:</p>
  
  <pre><code>public class Main extends Application {
  
      @Override public void start(Stage stage) {
          BorderPane root = new BorderPane();
          Scene scene = new Scene(root, 400, 400);
  
          HTMLEditor editor = new HTMLEditor();
          root.setCenter(editor);
  
          Platform.runLater(editor::requestFocus);
  
          stage.setScene(scene);
          stage.show();
      }
  
      public static void main(String[] args) {
          launch(args);
      }
  
  }
  </code></pre>
  
  <p>If I run this (the editor has focus), I am greeted by this rather bleak looking window, and if I type anything, I immediately get a <code>NullPointerException</code>:</p>
  
  <pre><code>Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
      at com.sun.javafx.scene.web.skin.HTMLEditorSkin.applyTextFormatting(HTMLEditorSkin.java:1100)
      at com.sun.javafx.scene.web.skin.HTMLEditorSkin.lambda$new$3(HTMLEditorSkin.java:293)
      at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
  ...
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/wwmzk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wwmzk.png" alt="enter image description here"></a></p>
  
  <p>The three things I noticed at first were:</p>
  
  <ol>
  <li>The error seems to be related to <code>HTMLEditorSkin</code>, so I tried applying one but Eclipse informs me this class is not API. How can I use this (if I should) and if yes, should I make an access restriction (since JavaFX itself is not API either)?</li>
  <li>The <code>HTMLEditor</code> looks unfocused, <strong>and has no selected font by default</strong> (I think this is where the problem is being caused.)</li>
  <li>The <code>HTMLEditorSkin</code> is from the package hierarchy <code>com.sun.javafx</code> and not <code>javafx</code>.</li>
  </ol>
  
  <p>However, it seems that I am doing everything correctly according to the <a href="http://docs.oracle.com/javafx/2/ui_controls/editor.htm" rel="nofollow noreferrer">first example of Oracle's tutorial</a>.</p>
  
  <p>What is going wrong here? It feels like this may be a bug.</p>
  
  <hr>
  
  <p>Attempted solutions and already-received answers:</p>
  
  <ol>
  <li>Setting initial text with <code>setHtmlText</code>.<br><code>setHtmlText("&lt;body style='font-family: something;'&gt;text&lt;/body&gt;");</code><br>It does set the text and a font but the editor is unaffected.</li>
  <li>Set style with <code>setStyle</code>.<br><code>setStyle("-fx-font: 12 something");</code><br>This only changes the UI font.</li>
  <li>Installing JDK 8u122.</li>
  </ol>