From ggc
|
01 packagepackage is used to name the directory or folder a class is in jam;
02
03 importimport means to make the classes and/or packages available in this program fang.*;
04 importimport means to make the classes and/or packages available in this program java.awt.*;
05
06 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 MyArt extendsextends means to customize or extend the functionality of a class Game
07 {open braces start code blocks and must be matched with a close brace
08 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setup()
09 {open braces start code blocks and must be matched with a close brace
10 OvalSprite oval=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor OvalSprite(0.75, 0.75);
11 oval.setLocation(0.5, 0.5);
12 oval.setColor(Color.YELLOW);
13
14
15 ImageSprite bigJam=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite("resources/Diploma.gif");
16 bigJam.setScale(1.0);
17 bigJam.setLocation(0.5, 0.5);
18 addSprite(bigJam);
19 addSprite(oval);
20
21 PolygonSprite eye1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(5);
22 eye1.setScale(0.25);
23 eye1.setLocation(0.35, 0.35);
24 addSprite(eye1);
25
26 PolygonSprite eye2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(5);
27 eye2.setScale(0.25);
28 eye2.setLocation(0.65, 0.4);
29 addSprite(eye2);
30
31 PolygonSprite nose=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(3);
32 nose.setScale(0.1);
33 nose.setLocation(0.5, 0.5);
34 addSprite(nose);
35
36 PolygonSprite mouth=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor PolygonSprite(0, 0, 1, 0, 0.25, 0.25);
37 mouth.setScale(0.5);
38 mouth.setLocation(0.5, 0.75);
39 addSprite(mouth);
40 }close braces end code blocks and must match an earlier open brace
41 }close braces end code blocks and must match an earlier open brace
|
Download/View jam/MyArt.java