Use as Applet

Introduction
In order to use jV as an applet, Java Plug-in must be installed on client computers. The applet is called from usual APPLET tags, or OBJECT and EMBED tags in HTML (see Java Plug-in homepage), where class name that should be called is "org.pdbj.viewer.gui.ViewerApplet" class. The program has following features.
 * whether to use the command line interface or not can be specified
 * whether to use the file control panel or not can be specified
 * whether to use the popup menu or not can be specified
 * witihin applets in the same web page, mouse events can be shared
 * applet can receive a command string from JaveScript
 * applet can send information about mouse-picked atoms to JavaScript.

Parameters
To initialize the applet, the following parameters can be specified in HTML.

JavaScript-to-Applet Communication
The ViewerApplet class has some public methods, which can be called from JavaScript.

void executeCommand(String commands)

Through this method, the applet can receive some arbitrary commands (delimited by semicolon).

void loadMmcif(String fileLocation) void loadPDB(String fileLocation) void loadPDBML(String fileLocation) void loadFTP(String pdbId) void loadPolygon(String fileLocation) void loadPolygonCGO(String fileLocation) void loadAnim(String fileLocation)

Using these methods, mmCIF file, PDB file, PDBML file, polygon file, and animation file specified by URL can be loaded respectively. The loadFTP method receives a PDB ID and retrieves a PDBML file from the PDBj FTP site, which works only in a signed applet.

void loadMmcif(String fileLocation, int fitTo) void loadPDB(String fileLocation, int fitTo) void loadPDBML(String fileLocation, int fitTo) void loadFTP(String pdbId, int fitTo) void loadPolygon(String fileLocation, int fitTo) void loadPolygonCGO(String fileLocation, int fitTo) void loadAnim(String fileLocation, int fitTo)

When these methods are used, the transform matrix of the loaded file is set identical to that of the specified file.

void loadMmcif(String fileLocation, int fitTo, String biomolecule, String filter) void loadPDB(String fileLocation, int fitTo, String filter) void loadPDBML(String fileLocation, int fitTo, String biomolecule, String filter) void loadFTP(String pdbId, int fitTo, String biomolecule, String filter) void loadAnim(String fileLocation, int fitTo, String filter)

When these methods are used, biomolecule structure and filter can also be specified. The arguments fitTo, biomolecule and filter can be set as -1, null and null, respectively, if you do not need to use some of them.

Applet-to-JavaScript Communication
In order to send the result of mouse-picking to JavaScript, the following function must be defined in JavaScript.

function receiveMousePick(file, model, chain, res, atom, altloc, resName, atomName, x, y, z)

The function name 'receiveMousePick' is a default name. It can be changed by specifying the 'picking_receiver' parameter in APPLET or OBJECT/EMBED tags.

When the applet started, it invokes the following JavScript function

function jvOnStart(name)

if it is configured to do so by the applet parameter 'call_on_start'. Here the function receives the name of the applet as its argument.

In order to enable applet-to-JavaScript communications, a new attribute 'MAYSCRIPT' is required in APPLET or OBJECT/EMBED tags (see Java Plug-in guide).

Available applet code for each environment
Which type of applet code works or not in each environment is described here.