Java Reference
In-Depth Information
LISTING B.3
Continued
50: name = getParameter(“Name”);
51: date = getParameter(“Date”);
52: String versText = getParameter(“Version”);
53: if (versText != null) {
54: version = Integer.parseInt(versText);
55: }
56: }
57:
58: /**
59: * This method is called when the applet's display window is
60: * being repainted.
61: */
62: public void paint(Graphics screen) {
63: Graphics2D screen2D = (Graphics2D)screen;
64: screen.drawString(“Name: “ + name, 5, 50);
65: screen.drawString(“Date: “ + date, 5, 100);
66: screen.drawString(“Version: “ + version, 5, 150);
67: }
68: }
B
The following command will create HTML documentation from the source code file
AppInfo2.java
:
javadoc -author -version AppInfo2.java
The Java documentation tool will create several different web pages in the same folder as
AppInfo2.java
. These pages will document the program in the same manner as Sun's
official documentation for the Java class library.
To see the official documentation for Java 6 and the Java class
library, visit
http://java.sun.com/javase/6/docs/api.
TIP
To see the documentation that
javadoc
has created for
AppInfo2
, load the newly created
web page
index.html
on your web browser. Figure B.4 shows this page loaded with
Mozilla Firefox.
The
javadoc
tool produces extensively hyperlinked web pages. Navigate through the
pages to see where the information in your documentation comments and tags shows up.
If you're familiar with HTML markup, you can use HTML tags such as
A
,
TT
, and
B
within your documentation comments. Line 5 of the
AppInfo2
program uses an
A
tag to
turn the text “Rogers Cadenhead” into a hyperlink to this topic's website.