Wednesday Apr 15, 2009

JavaFX - Where is Applet tag?!


For deploying JavaFX in browser, we use JavaScript code as shown below

<script src="http://dl.javafx.com/1.1/dtfx.js"></script>
<script>
    javafx(
        {
              archive: "JavaFX_Flickr_Image_Viewer.jar",
              draggable: true,
              width: 800,
              height: 650,
              code: "carousel.Main",
              name: "JavaFX_Flickr_Image_Viewer"
        }
    );
</script>

JavaFX uses dtfx.js which in turn uses deployJava.js to detect presence of java, the version of java on the system etc. Refer to Java Deployment Toolkit documentation for more information.

So how does JavaFX deploys as Applet without using Applet tag?

It indeed uses Applet tag, dtfx.js script generates the required Applet tag. It generates two <div> sections. The first section shows the spinning java logo and second sections embeds the Applet. First the spinning logo is shown, when applet is loaded, its visibility status is changed to false.

The generated html tags will be as shown below, which has embedded Applet tag

<script src="http://dl.javafx.com/1.1/dtfx.js"></script>
<div id="deployJavaApplet1Overlay" 
    style="width:800;height:650;position:absolute;background:white">
    <table width=800 height=650 border=padding=margin=0>
    <tr><td align="center" valign="middle">
        <img src="http://dl.javafx.com/javafx-loading-100x100.gif" width=100 imgHeight=100>
    </td></tr>
    </table>
</div>
<div id="deployJavaApplet1" style="position:relative;left:-10000px">
    <APPLET MAYSCRIPT
        code="org.jdesktop.applet.util.JNLPAppletLauncher"
        archive="JavaFX_Flickr_Image_Viewer.jar,
        http://dl.javafx.com/applet-launcher__V1.1.1.jar,
        http://dl.javafx.com/javafx-rt__V1.1.1.jar,
        http://dl.javafx.com/fxdloader__V1.1.1.jar,
        http://dl.javafx.com/jmc__V1.1.1.jar,
        http://dl.javafx.com/Decora-SSE__V1.1.1.jar,
        http://dl.javafx.com/emptyJarFile-1239792034654__V1.1.1.jar"
        width=800
        height=650>
        <param name="codebase_lookup" value="false">
        <param name="subapplet.classname" value="com.sun.javafx.runtime.adapter.Applet">
        <param name="progressbar" value="false">
        <param name="classloader_cache" value="false">
        <param name="draggable" value="true">
        <param name="MainJavaFXScript" value="carousel.Main">
        <param name="subapplet.displayname" value="JavaFX_Flickr_Image_Viewer">
        <param name="jnlpNumExtensions" value="2">
        <param name="jnlpExtension1" value="http://dl.javafx.com/jmc__V1.1.1.jnlp">
        <param name="jnlpExtension2" value="http://dl.javafx.com/Decora__V1.1.1.jnlp">
        <param name="jnlp_href" value="JavaFX_Flickr_Image_Viewer_browser.jnlp">
        <param name="deployJavaAppletID" value="deployJavaApplet1">
    </APPLET>
</div>

How will we get this generated Applet tag?

Just add displayhtml: true as shown below. This will display the html instead of loading the applet!

<script src="http://dl.javafx.com/1.1/dtfx.js"></script>
<script>
    javafx(
        {
              archive: "JavaFX_Flickr_Image_Viewer.jar",
              draggable: true,
              width: 800,
              height: 650,
              code: "carousel.Main",
              name: "JavaFX_Flickr_Image_Viewer",
              displayhtml: true
        }
    );
</script>

<script type="text/javascript">var dzone_url = "http://blogs.sun.com/rakeshmenonp/entry/javafx_sudoku_css_support";</script> <script type="text/javascript">var dzone_style = '2';</script> <script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script>
<script type="text/javascript"> digg_skin = 'compact'; digg_window = 'new'; </script> <script language="javascript" src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>
<script src="http://slashdot.org/slashdot-it.js" type="text/javascript"></script>

About


The views expressed on this blog are my own and do not necessarily reflect that of my organization

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today