-
You have already been looking at an API for DrawingTool. The purpose of Handout A1.1 was to give you an introduction to the purpose of the class and how to use its various methods.
-
When instructed to draw a circle, you probably looked at Handout A1.1 and saw this:
public drawCircle (double r);
postcondition
- If the object is in drawing mode, a circle of radius r is drawn around the current location using the current
width and color .
|
|
This is not the official Java format for an API, but it accomplishes the same thing. Without this handout, how would you have known how to draw a circle? How about when you made the picture of the house? How would you have known to use the forward method, turnLeft, down, or up? As you can see, APIs are an essential tool that must be looked at before a programmer can understand how to use pre-made classes.
-
Now that you understand how to read the DrawingTool API, take a look at a sample (the Pizza Parlor assignment) in the Javadoc folder for this lesson. Open up the index-all.html
file in your Web browser to see a basic package view. Click on the Help Link at the top to access a page on “How This API Document is Organized”. Links that do not work are simply placeholders. The feature that you are clicking on does not exist for that class.