JavaFX on the Web

In this section, we will learn about JavaFX on the Web and how to deploy our note-taking application there.

WebEngine

JavaFX provides a non-GUI component capable of loading HTML5 content, called the WebEngine API (javafx.scene.web.WebEngine). This API is basically an object instance of the WebEngine class to be used to load a file containing HTML5 content. The HTML5 file could be loaded from a local file system, a web server, or from inside a JAR file.

When a file is loaded using a web engine object, a background thread is used to load the file content to not block the JavaFX application thread.

The following are two WebEngine methods for loading HTML5 content:

  • load(String URL)
  • loadContent(String HTML)

WebView

JavaFX provides a GUI ...

Get JavaFX Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.