Running an applet
Introduction
We are now going to look at how to run an applet from Objecteering. First, we have to select the "DukeApplet" class in the "Duke" package in the "FirstSteps" project.
Very important warning!!
If you are using the JDK 1.2 or more recent, you may have to copy the .java.policy file from the $OBJING_PATH/mdaplugs/JavaDeveloper/4.1.0/FirstSteps into your home directory. Alternatively, you may have to concatenate its contents with your .java.policy file, if it already exists.
Visualizing the HTML file
The "Visualize
the applet" command in the element context menu displays the current content of
the HTML file used to run the applet. This command
does not work for a class that do not generalize the "Applet"
class.
Run the "Java Developer/Visualize the applet" command on the "DukeApplet" class. The window shown in Figure 25 then appears.

Figure 25. Window used to visualize the applet of the "DukeApplet" class
Editing the HTML file
The "Edit
the applet" command in the element context menu opens an editor on the HTML file,
allowing the applet to be modified (Figure 26). This command
does not work for a class that do not specialize the "Applet"
class.
Run the "Java Developer/Edit the applet" command on the "DukeApplet" class. The window shown in Figure 26 then appears.

Figure 26.
Window for editing the applet of the "DukeApplet" class
Steps:
1. Include the following line:
For Windows:
<param name="imagesPath"
value="file:/c:/objecteering/mdaplugs/JavaDeveloper/4.0.0/
FirstSteps/gif/">
if Objecteering is located in "c:\objecteering"
For Unix:
<param name="imagesPath" value="file:/usr/objecteering/mdaplugs/JavaDeveloper/4.0.0/
FirstSteps/gif/">
if Objecteering is located in "/usr/objecteering"
Running an applet
The "Launch
applet" command in the element context menu runs the applet (Figure 27). This command does not work for a class that do not generalize the "Applet"
class.
To run the
Java applet, you must have the correct rights in the
$JDK_PATH/jre/lib/security/java.policy file. To this end, you may have to add the following
line to the afore-mentioned file, before being able to run the applet
correctly:
grant { permission java.security.AllPermission;};
Run the "Java Developer/Launch applet" command on the "DukeApplet" class'.

Figure 27. Applet run on "DukeApplet" class