Java Reference
In-Depth Information
When the HTML file is accessed through the web, the browser renders the embedded applet
inside the HTML page as shown in the following screenshot:
If you are running 64-bit Windows 7, you must run your applets in a 64-bit
browser for your applet to run properly.
How it works...
The applet runtime is designed to run Java desktop applications inside the browser. Unlike
traditional desktop applications, applets are rendered directly within the web page using
a frameless window, as shown in the previous screenshot. Users are not able to minimize,
resize, or close the applet while within the browser.
Let's examine how we achieved this in our recipe:
F The JavaFX code—the code presented in the recipe is purely illustrative. There is
nothing special about it. However, notice that we are not using any applet-specific
APIs in the code that hints at the targeted environment. That is the power of the
unified development and deployment model in JavaFX. The developer concentrates
on creating the application and the tool chain handles building the code for the
target environment.
F The HTML file—the packager tool generates a sample HTML file,which shows you
how to use JavaScript to embed the JavaFX applet within the page. The generated
JavaScript does a couple of things:
It loads a Sun-provided JavaS cript library http://dl.javafx.
co m/1.2/dtfx.js that contains the code to bootstrap the applet
within th e HTML page.
It calls the function javafx() , which takes as parameter an
associative array with configuration settings, including the JAR
name, applet dimensions, main class, and name of application.
 
Search WWH ::




Custom Search