This preview shows page 1 out of 4 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 4 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 4 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CompSci 4 27jd.1JavadocJavadocCompSci 4 27jd.2JavadocThe Planÿ What is Javadoc?ÿ Writing Javadoc commentsÿ Using the Javadoc toolÿ PracticeCompSci 4 27jd.3JavadocWhat is Javadoc?Javadoc is a way to comment your code that enablesautomatic generation of web pages that documentyour code.Why use Javadoc?ÿ It's much faster than generating webpagesdocumenting your code.ÿ It's standard documentation which means it's easyto use and the structure is given.CompSci 4 27jd.4JavadocWriting Javadoc Commentÿ Javadoc comments start with /** and end with */ÿ The placement of the comment is important.ÿ The following can be commented:þ classesþ methodsþ instance variablesþ static variablesCompSci 4 27jd.5Javadocpackage tipgame;/*** Used to enable timed events.* @author Jam Jenkins*/public interface Alarm{/** creates alarm */public void alarm();}Writing Javadoc CommentJavadocCommentsCompSci 4 27jd.6JavadocCommenting a Classÿ Put the comment immediately before the classdeclaration.ÿ Briefly describe the purpose of the class in 2-3sentences.ÿ Optionally includeþ @author tagþ @version tagþ othersCompSci 4 27jd.7JavadocCommenting a Class/*** This class uses polling rather* than events for keyboard input.** @author Jam Jenkins */public class Keyboard implementsCompSci 4 27jd.8JavadocCommenting a Methodÿ Put the comment immediately before the methoddeclaration.ÿ Briefly describe the purpose of the method in ashort phrase or 2-3 sentences. Include more detailif necessaryÿ Include these tags if neededþ @param name – describes parameterþ @return – describes the return valueCompSci 4 27jd.9JavadocCommenting a Method/** Simulates the surface normal used for* bouncing the moving object off of the* stationary object. Normal is in the* direction from the surface of the* stationary object to the center of the* moving shape's bounding box.* @param stationary the object not in motion* @param moving the object that will bounce* of the stationary object* @return the radians of the normal vector*public static double getNormalVector(Shape stationary,Shape moving)CompSci 4 27jd.10JavadocCommentingInstance and Static Variablesÿ Put the comment immediately before the variabledeclaration.ÿ Briefly describe the purpose of the variable in ashort phrase. Include more detail only ifabsolutely necessary.ÿ No tags needed.CompSci 4 27jd.11JavadocCommentingInstance and Static Variables/** shape should initially be centered at (0, 0) */private GeneralPath shape;/** transformed shape */private GeneralPath shapeTransformed;/** applied to the shape prior to drawing it */private AffineTransform transform;/** the fill color of the shape, black by default */protected Color color;CompSci 4 27jd.12JavadocFor more information...Visit the article:How to Write Doc Comments for the Javadoc Toolhttp://java.sun.com/j2se/javadoc/writingdoccomments/index.htmlCompSci 4 27jd.13JavadocGenerating HTML using the JavadocTool in Eclipse1. Highlight the project you want to javadoc in the Project Explorer2. Select File->Export->Javadoc3. Under the ‘Javadoc command:’ enter the location of javadoc if it is notalready there. The location should be something like:C:\Program Files\Java\jdk1.5.0\bin\javadoc.exe4. For the ‘visibility’ select Private5. Select ‘Use Standard Doclet’6. For the ‘Destination’, enter where you want the html code generatedto go. The html in the location you choose will be overwritten withthe javadoc generated HTML, so make sure not to choose a placewhich already has an index.html you’d like to keep.7. Click on ‘Finish’8. If you get the source files out of sync with file system error then sayokay, highlight your project, right click and select refresh. This willresync your files. Repeat the instructions above.CompSci 4 27jd.14JavadocPracticeÿ Put Javadoc comments in one of the previoushomework assignment's so urce code.ÿ Generate the javadoc HTML filesÿ Post the HTML files to your web site. Whentransferring the files, be sure to transport theminto an empty directory. DO NOT transfer themdirectly into your public_html page because thiswill overwrite your index.hml. Instead transferthem into a subdirectory of


View Full Document

Duke CPS 004 - Java

Documents in this Course
Lecture

Lecture

18 pages

Chapter 7

Chapter 7

18 pages

Chapter 9

Chapter 9

15 pages

Java 1

Java 1

24 pages

Java 3

Java 3

11 pages

Lecture

Lecture

10 pages

Chapter 4

Chapter 4

28 pages

Chap 2

Chap 2

16 pages

Graphics

Graphics

20 pages

Lecture

Lecture

12 pages

HTML

HTML

16 pages

Java 1

Java 1

6 pages

Chapter 4

Chapter 4

16 pages

The Plan

The Plan

25 pages

Lecture

Lecture

16 pages

Chapter 6

Chapter 6

21 pages

Lecture

Lecture

18 pages

Lecture

Lecture

23 pages

Lecture

Lecture

16 pages

Lecture

Lecture

19 pages

Lecture

Lecture

12 pages

Lecture

Lecture

5 pages

Lecture

Lecture

26 pages

Lecture

Lecture

16 pages

Chapter 7

Chapter 7

23 pages

Lecture

Lecture

21 pages

Lecture

Lecture

4 pages

Lecture

Lecture

4 pages

Lecture

Lecture

8 pages

Lecture

Lecture

4 pages

Lecture

Lecture

10 pages

Chapter 4

Chapter 4

32 pages

CompSci 4

CompSci 4

18 pages

Lecture

Lecture

26 pages

CompSci 4

CompSci 4

12 pages

HTML

HTML

17 pages

Lecture

Lecture

16 pages

Chapter 5

Chapter 5

22 pages

Lecture

Lecture

4 pages

Chapter 4

Chapter 4

10 pages

Chapter 2

Chapter 2

15 pages

Chapter 8

Chapter 8

14 pages

Lecture

Lecture

15 pages

Load more
Download Java
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Java and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Java 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?