Javadoc Comment Dialog Box

Using the Javadoc Comment dialog box, you can add or edit a documentation comment in your source code. Open the Javadoc Comment dialog box for a specific class by clicking its Javadoc property in the property inspector or by clicking Edit Comment in the Auto Comment Tool.

A Javadoc comment begins with the characters /**, ends with the characters */, and consists of two parts: text and tags.

Text of a Documentation Comment

The first sentence of the comment should be a summary description of the declared entity. The text may include HTML elements (such as <B> and <I>) for formatting the description. Heading elements (such as <H1> and <H2>) are reserved for use by Javadoc. You can use the command buttons at the bottom of the dialog box to include the HTML elements <B>, <I>, <U>, <CODE>, and <PRE> and the Javadoc {@link} in the description. For example:
/**
* Returns the Class of this <I>Object</I>. 
* Java has a runtime representation for 
* classes--a descriptor of type Class-- 
* which the method getClass() returns for 
* any Object.
*/
You do not need to type the characters /** and */ or the leading asterisks in the the Javadoc Comment dialog box. These characters are automatically included when you click OK and the IDE adds the comment to the source code.

Tags in a Documentation Comment

A Javadoc tag starts with the character @ followed by a special keyword. Tags are case sensitive. A Javadoc tag enables you to automatically generate information for the API documentation. For example, @author name adds an author entry with the specified name to the generated documentation. A tag must appear at the beginning of a line (otherwise it is treated as normal text). By convention, tags with the same name are grouped together. The following comment includes four Javadoc tags:
/**
* A class representing a screen window.
* For example:
*    Window win = new Window(parent);
*    win.show();
*
* @author  Lynne Sim
* @version 1.3 00/08/08
* @see     java.awt.BaseWindow
* @see     java.awt.Button */

To add a Javadoc tag to your comment:

  1. In the Javadoc Comment dialog box, click New.

  2. In the New Tag dialog box, select a Javadoc tag or type a new tag and click OK.

    The tag is added to the Tags pane of the Javadoc Comment dialog box.

  3. In the Description field, type the text of the tag.

    The text may include HTML elements (such as <B> and <I>) and the inline Javadoc tag {@link}.

  4. Modify the Tags list as needed:
    To delete a tag from the list, select the tag and click Delete.
    To change the order of the tags, select a tag and move it with the Move Up and Move Down buttons.
For more information on how to write Javadoc comments, see the Sun Microsystems web page at http://java.sun.com/products/jdk/javadoc/writingdoccomments/index.html. For detailed information about Javadoc tags, see http://java.sun.com/j2se/1.3/docs/tooldocs/solaris/javadoc.html.
See also
Adding a Javadoc Comment to Source Code
Customizing the Output of Javadoc

Legal Notices