Skip to main content
ICT
Lesson A6 - Libraries and APIs
 
Main Previous Next
Title Page >  
Summary >  
Lesson A1 >  
Lesson A2 >  
Lesson A3 >  
Lesson A4 >  
Lesson A5 >  
Lesson A6 >  
Lesson A7 >  
Lesson A8 >  
Lesson A9 >  
Lesson A10 >  
Lesson A11 >  
Lesson A12 >  
Lesson A13 >  
Lesson A14 >  
Lesson A15 >  
Lesson A16 >  
Lesson A17 >  
Lesson A18 >  
Lesson A19 >  
Lesson A20 >  
Lesson A21 >  
Lesson A22 >  
Lesson AB23 >  
Lesson AB24 >  
Lesson AB25 >  
Lesson AB26 >  
Lesson AB27 >  
Lesson AB28 >  
Lesson AB29 >  
Lesson AB30 >  
Lesson AB31 >  
Lesson AB32 >  
Lesson AB33 >  
Vocabulary >  
 

C. DrawingTool page 5 of 12

  1. 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.

  2. 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 tells us exactly what we need to know to use this method. We have the name of the method and the type of argument it takes. We also know what will happen after the method is called.

  1. 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.

  2. 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.

 

Main Previous Next
Contact
 © ICT 2006, All Rights Reserved.