From FANG
|
01 packagepackage is used to name the directory or folder a class is in scg.ch03;
02
03 importimport means to make the classes and/or packages available in this program fang2.core.Game;
04 importimport means to make the classes and/or packages available in this program fang2.sprites.OvalSprite;
05
06 /** Draws an oval and a rotated copy of the oval. */
07 publicpublic is used to indicate unrestricted access (any other class can have access) classclass is a group of fields and methods used for making objects LeftWing
08 extendsextends means to customize or extend the functionality of a class Game {open braces start code blocks and must be matched with a close brace
09 /**
10 * Setup the "game": create two wings, original and rotated. Outline
11 * original in white, rotated in black. Demonstrate rotation
12 * direction.
13 */
14 @Override
15 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setup() {open braces start code blocks and must be matched with a close brace
16 // Let the bee fly on a grassy background.
17 setBackground(getColor("green"));
18
19 OvalSprite originalWing =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor OvalSprite(0.35, 0.7);
20 originalWing.setColor(getColor("Wheat", 128));
21 originalWing.setOutlineColor(getColor("white"));
22 originalWing.setOutlineThickness(0.01);
23 originalWing.showOutline();
24 originalWing.setLocation(0.36, 0.6);
25 addSprite(originalWing);
26
27 OvalSprite leftWing =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor OvalSprite(0.35, 0.7);
28 leftWing.setColor(getColor("Wheat", 128));
29 leftWing.setOutlineColor(getColor("black"));
30 leftWing.setOutlineThickness(0.01);
31 leftWing.showOutline();
32 leftWing.rotateDegrees(+adds two numbers together or concatenates Strings together45.0);
33 leftWing.setLocation(0.36, 0.6);
34 addSprite(leftWing);
35 }close braces end code blocks and must match an earlier open brace
36 }close braces end code blocks and must match an earlier open brace
37
38 //Uploaded on Mon Mar 29 21:42:34 EDT 2010
|
Download/View scg/ch03/LeftWing.java