Because Java applets have limitations that stand-alone applications do not have, there are differences between using the two.
In this section, we describe how to construct a web page with an embedded Notung applet. The following files are required:
The HTML required to embed the Notung applet in a web page must include a definition of notung.js. This is typically of the form
<head> <script src='notung.js'></script> </head> <body> <a href="javascript:openNotung( ... )" title="Notung JavaApplet"> Informative title goes here</a> </body>
The main work is carried out by the function openNotung, which takes four parameters:
Here are two examples of HTML code that defines javascript that calls openNotung(), creating a link to launch the Notung applet.
Example 1:
<head> <script src='notung.js'></script> </head> <body> <a href="javascript:openNotung( ['GENE_TREE_001'], ['SPECIES_TREE_001'], '', 'Example Trees One')" title="Notung JavaApplet"> Open GENE_TREE_001 and SPECIES_TREE_001 in Notung</a> </body>
In this example, the web page, jar file, notung.js, and trees are all located in the same directory.
Example 2:
<head> <script src='http://www.yourdomain.com/applet_files/notung.js'></script> </head> <body> <a href="javascript:openNotung( ['http://www.yourdomain.com/tree_files/GENE_TREE_001', 'http://www.yourdomain.com/tree_files/GENE_TREE_002'], [], '', 'Example Trees Two')" title="Notung JavaApplet"> Open GENE_TREE_001 and GENE_TREE_002 in Notung</a> </body>
In this example the Notung jar file and notung.js are both
located in the directory
http://www.yourdomain.com/applet_files.
The gene trees are located in the directory
http://www.yourdomain.com/tree_files. The web page can be
located anywhere on the webserver http://www.yourdomain.com/
This example displays two gene trees, and no species trees.
Because of restrictions on the actions of Java applets, all of the files used for the Notung applet (the jar file, notung.js, and the tree files) must be located on the same webserver as the web page.
<script src=`http://www.yourdomain.com/path/to/files/notung.js'> </script>
// url for jar file var jar = "Notung-2.6.jar"