Java Reference
In-Depth Information
public static void main(String[] args){
Application.launch(args);
}
}
This JavaFX code will load and render HTML5 content. Assuming that you have a
designer who has provided content such as HTML5, it will be your job to render assets
in JavaFX. The following code represents an SVG file named clock3.svg that is
predominantly generated by the powerful tool called Inkscape, which is an illustrator
tool capable of generating SVG. In the following code, notice hand-coded JavaScript
code (inside the CDATA tag) that will position the second, minute, and hour hands of
the clock based on the current time of day. Because all the logic (from setting the time
to animating the hands) is inside this file, things are self-contained, which means any
HTML5-capable viewer can display the file's contents. So when you're debugging, you
can easily render content in any HTML5-compliant browser. Later in this chapter, you
will see JavaFX code that can interact with HTML5 content.
Shown here is a pared-down version of the SVG analog clock. (To obtain the file's
source code, download the code from the topic's website.) This is an SVG analog clock
created in Inkscape ( clock3.svg ):
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/
sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/
inkscape"
width="300"
height="250"
id="svg4171"
version="1.1"
inkscape:version="0.48.1 "
sodipodi:docname="clock3.svg" onload="updateTime()">
Search WWH ::




Custom Search