Book Image

JavaFX Essentials

By : Mohamed Taman, Mohamed Taman
Book Image

JavaFX Essentials

By: Mohamed Taman, Mohamed Taman

Overview of this book

Table of Contents (16 chapters)
JavaFX Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
7
Monitoring and Controlling Arduino with JavaFX
Index

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 WebView (javafx.scene.web.WebView) node that can render HTML5 content onto the Scene graph. A WebView node is basically a mini-browser that is capable of responding to web events and allows a developer to interact with the HTML5 content.

Because of the...