The traditional way to put the MarvinSpace applet to a web page is by writing
the following text in the HTML:
<applet codebase="../../.."
code="chemaxon/marvin/space/gui/MSpaceApplet" name="MSpaceApplet" width=400 height=400
archive="mspace.jar,jmarvin.jar,jogl.jar">
<param name="progressbar" value="true">
<param name="selectionpanel" value="false">
<param name="molecule" value="http://www.chemaxon.com/marvinspace/data/1ETS.mol">
</applet>
Let's go through the special elements:
-
The
CODEBASE option specifies the directory of
the Marvin binaries relative to the HTML file. This HTML file is in a
subdirectory of the Marvin binaries directory, that's why we use
"../../.." here.
-
The
ARCHIVE option is needed to speed up the
downloads. The program code is packaged into compressed JAR files,
jmarvin.jar, mspace.jar and jogl.jar.
-
To indicate the loading the applet
progressbar can be used.
-
The applet parameter
selectionpanel is used to embed a simple MarvinSpace applet without
special GUI elements. However they can also be displayed, this will be discussed in
another example.
-
The
molecule applet parameter is an easy way to load molecule(s) by giving a
location of the input or a SMILES string.
To correctly work with Sun's Java Plugin, marvin.js
provides platform dependent solutions. Apart from the standard
<applet> tag, it uses
<embed> for Firefox (mozilla) and
<object> for Microsoft Internet Explorer.
The applet can be embedded in HTML pages using marvin.js the following way:
<script LANGUAGE="JavaScript" SRC="../../../marvin.js"></script>
<script LANGUAGE="JavaScript">
<!--
mspace_name="MSpaceApplet"; // naming the applet to allow JavaScript calls
mspace_begin(mspace_name,"../../..", 400, 400); // arguments: NAME, CODEBASE, WIDTH, HEIGHT
mspace_param("progressbar","true");
mspace_param("selectionpanel","false");
mspace_param("molecule","http://www.chemaxon.com/marvinspace/data/1ETS.mol");
msspace_end();
//-->
</script>