Getting Started with
JDoc: Rendering Complex HTML Documents
Rendering entire HTML documents using JDoc is as easy as using
any other Java applet.
- With any HTML/text editor, simply insert the following <applet> tag into
the HTML page at the point you want the document to
appear:
<APPLET CODE="earthstones/JDoc.class"
WIDTH=500 HEIGHT=575
codebase="java" name="JDocApp" hspace=0
vspace=0 >
<param name="source"
value="JDoc_announce.htm">
</APPLET>
- The code file "JDoc.class"
is the JDoc byte code which, along with JDoc's other
class files, must be located in the directory specified
by the codebase parameter (e.g., "java"
in the above example). The width and height
attributes reserve space for the applet on the HTML page.
The name attribute (e.g., "JDocApp")
can be set to any string value but is necessary to refer
to the applet from within a script (e.g., javascript; see
below). The attributes hspace and vspace
which provide white space around the applet in the HTML
page are optional.
- The above <parameter> tag with its
source attribute set (e.g., to "JDoc_announce.htm")
specifies the HTML file to be displayed when the applet
initially loads. If omitted, no default file will be
shown.
- Subsequently, a scripting language such as javascript can
be used to display a new file by sending the applet one
of the following messages:
JDocApp.update(file, vscroll, hscroll)
JDocApp.update(file, vscroll)
JDocApp.update(file)
- Here file is a string
identifying the file to be displayed. It may be either a
full URL (e.g.,
"http://www.myserver.com/myfile.html") or a
path relative to the document containing the applet tag
(e.g, "somerelativepath/myfile.html"). The scroll
parameters are boolean values specifying whether
horizontal and vertical scroll bars will be shown. The
default values for vscroll and hscroll
are true and false, respectively.
- Alternatively, another Java applet within the
HTML page can invoke JDocApp's update methods even
if it resides in a different frame (see Interapplet
Communication Tips).
- The applet tag specified above will place an unframed
window into your HTML page with its optional scrollbars.
Additional <parameter> tags can be included between
the <applet>
and </applet>
tags to set additional features of the JDoc interface
(see JDoc Applet
Parameters).
- To insure that the applet's relative size will be
independent of the user's screen resolution, the width
and height parameters specified in the <applet> tag must be
adjusted for this parameter (see Javascript
Wrappers for details). Your EarthStones/html
subdirectory contains JDocViewer.htm and related
files which illustrate the approach outlined in the Java
Wrappers discussion.