O'Reilly logo

Java 9 Cookbook by Nick Samoylov, Mohamed Sanaulla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Embedding HTML in an application

JavaFX provides support for managing web pages via the classes defined in the javafx.scene.web package. It supports loading the web page, either by accepting the web page URL or by accepting the web page content. It also manages the document model of the web page, applies the relevant CSS, and runs the relevant JavaScript code. It also extends support for a two-way communication between JavaScript and the Java code. 

In this recipe, we will build a very primitive and simple web browser, which supports the following:

  • Navigating through the history of the pages visited
  • Reloading the current page
  • An address bar for accepting the URL 
  • A button for loading the entered URL
  • Showing the web page
  • Showing the status ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required