Go backward to 2.4 Compiling the Program Go up to 2 Using the Toolkit |
An application developed with the DAJ toolkit can be embedded as an applet
into a Web page using the APPLET
tag. The applet can be customized by
the parameters specified below:
<APPLET code="C.class" width=w height=h> <param name=buttonLabel value=string> <param name=fontName value=string> <param name=fontStyle value=string> <param name=fontSize value=int> Please enable Java! </APPLET>
The applet loads class C.class
; it appears as a button of
width w and height h. The default label on the button is the title
specified in the constructor of the corresponding
Application
object; this label may be overridden by the applet
parameter buttonLabel
.
The font used for the button label may be customized using the applet
parameters fontName
, fontStyle
, and
fontSize
, each of which is optional and must determine a corresponding
Java font.
When writing applet code, please keep in mind that most current commercial browsers (e.g., Netscape Communicator 4.0) only provide reliable support for Java 1.0.x. Do not yet use Java 1.1.x if you want to write applets that can be executed by a variety of browsers.
For installing an HTML file including a DAJ applet on a Web server, one has to make sure that the corresponding DAJ classes are appropriately installed and served:
application/octet-stream
.
E.g., under the WN server, this is achieved by putting a file index into directories daj and daj/awt with contents
and callingDefault-Content=application/octet-stream Attribute=serveall
wndex
within each of both directories.
The applet has then to specify the attribute codebase
to denote the
URL of directory daj, i.e.,
<APPLET code="C.class" codebase="url" width=w height=h> </APPLET>
You may omit the codebase
attribute only if you install the directory
daj in the directory of the HTML file containing the applet.
However, when this support becomes available, the programmer may combine all the newly defined Java classes of his DAJ application into a Java archive (JAR) file a.jar by calling e.g.
This archive has to be installed together with the DAJ archives daj.jar and awt.jar in a directory served by the Web server making sure that these files are served with Content-Typejar cvf a.jar *.class
application/java-archive
.
E.g. under the WN server, this is achieved by putting a file index into this directory with contents
and callingAttribute=serveall Default-content=application/java-archive
wndex
within this directory.
The applet then has to specify the attributes codebase
and
archive
to denote the URL of the directory containing the JAR files
and the names of the files, respectively:
<APPLET code="C.class" codebase="url" archive="a.jar, daj.jar, awt.jar" width=w height=h> </APPLET>