4-2. Displaying HTML5 Content


You are so engrossed with a project for work that you often miss your kid’s soccer games. What you need is a clock application to keep track of the time.


Create a JavaFX based-application containing an analog clock that was created as HTML5 content. Use JavaFX’s WebView API to render HTML5 content in your application.

The following source code is a JavaFX application displaying an animated analog clock. The application will load an SVG file named clock3.svg and display the contents onto the JavaFX Scene graph:

package javafx2introbyexample.chapter4.recipe4_02; import java.net.URL; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.scene.web.WebView; ...

Get JavaFX 2.0: Introduction by Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.