Adding a Javadoc Comment to Source Code

You can type a Javadoc comment directly in the Source Editor. If you need help with the content or format of a Javadoc comment, use the Auto Comment dialog box to create your comment.

To add a comment using the Auto Comment dialog box:

  1. Right-click in the Source Editor and choose Tools and choose Auto Comment.

    The Auto Comment Tool dialog box opens and displays the methods in the source code and their Javadoc status. OK icon indicates a valid Javadoc comment, Error icon indicates a partial or erroneous comment, and Missing icon indicates no comment.

  2. In the Auto Comment Tool dialog box, select the method for which you want to create a comment.

    If the Javadoc executor cannot generate tags for the comment, the Auto-Correct button is inactive.

  3. Click Auto-Correct.

    The IDE takes following actions:

    For example, if your code includes the method

    public String myMethod(Object param1, Object param2){}
    
    and you click Auto-Correct, the IDE generates the following tags:
    
    @param param1
    @param param2
    @return
    
  4. In the Javadoc Comment Text panel, type the text of the comment.

    At the bottom of the dialog box is a row of command buttons you can use to include HTML elements for formatting your text. You can also include the Javadoc tag {@link}.

  5. Make any other edits you need to the complete the comment.

    The Details panel will include "Javadoc comment OK" when the comment is correct.

For more information about Javadoc tags, visit the Sun Microsystems web page at
http://java.sun.com/j2se/1.3/docs/tooldocs/solaris/javadoc.html. For information on how to write Javadoc comments, see
http://java.sun.com/products/jdk/javadoc/writingdoccomments/index.html.

See also
Format of a Javadoc Comment
Generating Javadoc Documentation

Legal Notices