Download AP Computer Science Name Graphics Reading Guide Period

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
AP Computer Science
Graphics Reading Guide
Name _________________________________________
Period _______________
Complete the following notesheet using the readings from Java Software Solutions that have been posted
on the website. Use BlueJ as necessary to explore what the different methods do in the graphics applet.
Section 2.7 – Class Libraries and Packages (JSS, page 91)
1. What is a class library? Why are class libraries important to us as programmers?
2. What does API stand for and what are Java APIs?
3. Explain what a package is in a Java class library.
4. Which Java package is automatically available when writing a program?
5. How do we call other packages into our program classes? List a few examples. (See page 94.)
6. What does the asterisk mean in a package declaration?
Section 2.8 – Invoking Class Methods (JSS, page 98)
7. In order to use Random numbers, we need to call that package into our classes. What about the Math
class? Do you need to call the Math class library into your class when programming? Why or why not?
8. What does the reserved word static mean?
Section 1.5 – Graphics (JSS, page 47)
9. What is a pixel?
10. How is a picture digitized? How is it stored?
11. How is the Java coordinate system different from a Cartesian coordinate system? Explain.
12. Why is it insufficient to represent pixels in a picture using only one bit?
13. What does RGB stand for and is an RGB value?
Section 2.10 – Introduction to Applets (JSS, page 106)
14. What is a Java applet?
15. What is a Java application?
16. What is the point of making a Java applet?
17. How is an applet executed over the Web?
18. What method is automatically invoked by an applet when it is opened/used? Why?
19. What are the two import statements you need at the beginning of a program that is an applet?
20. What is a Graphics object?
21. What does HTML stand for and what is the role of an HTML document?
Section 2.11 – Drawing Shapes (JSS, page 111)
22. What is the different between filled and unfilled shapes in the Graphics class?
23. Read the rest of this section in the textbook. Then use the reading, the extra web pages listed on the
class website, and BlueJ to fill in the following information about the methods of the Graphics class. Fill in
the parameters and what they do, as well as what the method does in general. Test all of them in BlueJ.
void drawString( __________, ______, ______)
void drawLine( ______, ______, ______, ______)
void drawArc( ______, ______, _________, _________, __________, _________)
void fillArc( ______, ______, _________, _________, __________, _________)
void drawOval( ______, ______, __________, __________)
void fillOval( ______, ______, __________, __________)
void drawRect( ______, ______, __________, __________)
void fillRect( ______, ______, __________, __________)
void drawRoundRect( ______, ______, ________, ________, ________, _______)
void fillRoundRect( ______, ______, ________, ________, ________, _______)
void draw3DRect( ______, ______, __________, __________, ________________)
void fill3DRect( ______, ______, __________, __________, ________________)
Color getColor( )
void setColor(Color color)
24. How are colors defined and managed in Java?
25. Study figure 2.21 that displays a set of predefined colors. What patterns to do you notice in the
definitions of those colors? Think back to the section on RGB.
26. What is the difference between the foreground and background in the Graphics class? Look at the
code for the snowman for verification of your answer.
Section 3.10 – Drawing Using Conditionals and Loops (JSS, page 187)
27. How does the program called Bullseye use a loop to make it more efficient?
28. How does the program Boxes use the Random numbers class? How does the program
BarHeights use the Random class differently from Boxes?
Section 4.6 – Applet Methods (JSS, page 255)
29. What is the init method? What is it used for that is different from how the paint method is used?
30. What are the start and stop methods in an applet?
31. How is the start method different from the init method?
32. What are the getCodeBase and getDocumentBase methods used for?
33. What are the getImage and getAudioClip methods and what do they do?
Section 4.7 – Graphical Object (JSS, page 256)
34. Notice how the StickFigure class is a separate class that is called by LineUp class. When are the
StickFigure classes drawn? How do they interact in the applet window?
Section 5.7 – Graphical User Interfaces (JSS, page 304)
35. What does GUI stand for and what is a GUI?
36. Define a GUI component.
37. What is a container?
38. Define a GUI event.
39. Define a GUI listener.
40. What are the steps for creating a Java program that uses a GUI?
41. What is a listener interface?
42. What is a text field?
43. What is a frame?
44. What is a panel?
Section 6.5 – Polygons and Polylines (JSS, page 359)
45. How are polygons drawn in Java? Explain what you know about both versions. (Include in your
answer how the drawPolygon and fillPolygon methods work.)
46. What is a polyline? Explain how it is created in Java.
47. What is a Polygon object? What are the differences between its two constructors?
48. What does the translate method do in the Polygon class? How does it work?
Section 6.6 – Other Button Components (JSS, page 363)
49. What is the JButton class? (You can look back in section 5.7 if you need to.)
50. What is a check box? How does it work?
51. What are the item events of the JCheckBox class in the StyleOptions example code?
52. What is the Font class? What all is defined in a Font object?
53. What is a radio button? How does it work?
54. What is a toggle button?
Section 7.6 – Inheritance and GUIs (JSS, page 422)
55. What are the two primary GUI APIs used in Java? Explain each of them.
56. Why does the applet class use inheritance, a.k.a extends from the parent class?
57. Study the hierarchy of GUI components in Figure 7.9. What to the direction of the arrows indicate?
Who is the main parent class?
58. In which class is the paint method defined?
Section 7.7 – Mouse Events (JSS, page 425)
59. How are mouse events different from mouse motion events?
60. What are all of the different mouse events that we can program into a class?
61. Explain what are the mouse entered and mouse exited events.
62. What is the DotsPanel class keeping track of and how does it do that?
63. What are the two mouse-oriented events in the RubberLines example program?
64. What is rubberbanding?
65. What is an event adapter class?
66. What are our choices for creating event listeners now that we can use inheritance? How do you
know when to use which choice?
Section 8.4 – Animations (JSS, page 494)
67. What is an animation?
68. What is a timer object? How do we use timers to perform an animation?
Chapter 9 is all about GUIs in more detail, and Section 11.3 is on Recursion in Graphics. Check out the
repeating goat picture in the recursion section, but you don’t have to read these sections unless you want to.