Applet design elements
Table of contents
As stated in the primer section, an applet is a small non-standalone Java program. When an applet is loaded from a notes design element, either in the Notes client or Web client, the applet code is downloaded on the user's machine and subequently run.
An applet can be contained in several Notes design elements:
- Form: The applet is included in each document created with that form.
- Document: The applet is available only in the document.
- Page: The applet is available only in the page.
To include an applet into an application, you must first do the following actions:
- Enable Java applets on your workstation (Notes client only)
- Import the applet or link to an applet on the Web
- Set the applet parameters and attributes in the properties box of the applet.
You cannot directly create applets in Domino Designer, as its Java IDE is limited in regards to this capability. You must create the applet in an external Java IDE and then import the class file or files for the applet into the Domino Database. To do the import, go to the Shared Resources section of the database in Domino Designer, and click Applets
to open the design pane. Then click the New Applet Resource
action button. The Locate Java Applet Files window opens (see the following figure).
After you select the directory from your file system, select the proper files and click either of the Add/Replace
buttons to include them in the applet resource. You are prompted to give the resource a name, and then you are done.
You can use other Java resources/filetypes for your applet, for example:
- Class files (*.CLASS)
- Archive files (*.JAR, *.ZIP, *.CAB)
- Resource ( *.JPG, *.JPEG, *.GIF, *.AU)
- Source ( *.JAVA)
When selecting files, select the archive files, or, class file or files and resource files that are needed to execute the main applet class. Source files are not needed unless you plan to send the applet to another user who wants to export them and change the applet.
You can insert an applet into a notes design element and specify one of three sources.
- Local file system
- Domino Designer applet shared resource
- Web URL
When inserting an applet into a Notes element, in Domino Designer click Create
followed by Java Applet
. The Create Java Applet window opens (see the following figure).
You can specify that the applet comes directly from files on the file system or a shared resources (as created previously). The first window is used to directly specify files from your file system. If you want to use a shared resource, click on Locate
. If you click Locate, the following window opens to assist you in selecting your files, either from your file system or from a shared resource.
Inserting from the file system or shared resource
If you are inserting an applet that is packaged as a JAR file, ensure that you specify the correct class name for the main class file of the applet. Browsing for the JAR file inserts the filename with a "class" extension in the class name field. If the file name and the main applet class name are the same, this is fine, but if it is not, then you must edit the class name field to be the correct class to be loaded when the applet runs.
Inserting from the Web
In the Create Java Applet window, select Link to an applet on a Web server. In the base URL field, enter the URL where the applet files are stored. Do not specify the document that references the applet. Specify the location of the main applet class file as shown in the following example:
http://<web server url>/<applet directory>/<applet class name only, with no filetype>
In the Base class name field, enter the name of the main class. Note that Java is case-sensitive to file names.
Applets can provide rich visual functionality to any application. Take the time to research and sample their use, and decide whether its right for your Domino application.