O'Reilly logo

JavaFX 2.0: Introduction by Example by Carl Dea

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

4-3. Manipulating HTML5 Content with Java Code

Problem

You are an underpaid developer, and your boss refuses to let you relocate to the cube next to the window. You must find a way to determine the weather without leaving your workspace.

Solution

Create a weather application that fetches data from Yahoo’s weather service. The following code implements a weather application that retrieves Yahoo’s weather information to be rendered as HTML in a JavaFX application:

package javafx2introbyexample.chapter4.recipe4_03; import javafx.animation.*; import javafx.application.Application; import javafx.beans.property.*; import javafx.beans.value.*; import javafx.concurrent.Worker.State; import javafx.scene.*; import javafx.scene.web.*; import javafx.stage.Stage; ...

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