Java Reference
In-Depth Information
22. The API (Application Programming Interface) documentation lists the classes
and methods of the Java library.
23. An object reference describes the location of an object.
24. Multiple object variables can contain references to the same object.
25. Number variables store numbers. Object variables store references.
26. To show a frame, construct a
JFrame
object, set its size, and make it visible.
27. In order to display a drawing in a frame, define a class that extends the
JComponent
class.
28. Place drawing instructions inside the
paintComponent
method. That method
is called whenever the component needs to be repainted.
29. The
Graphics
class lets you manipulate the graphics state (such as the current
color).
30. The
Graphics2D
class has methods to draw shape objects.
72
73
31. Use a cast to recover the
Graphics2D
object from the
Graphics
parameter
of the
paintComponent
method.
32. Applets are programs that run inside a web browser.
33. To run an applet, you need an HTML file with the applet tag.
34. You view applets with the applet viewer or a Java-enabled browser.
35.
Ellipse2D.Double
and
Line2D.Double
are classes that describe
graphical shapes.
36. The
drawString
method draws a string, starting at its basepoint.
37. When you set a new color in the graphics context, it is used for subsequent
drawing operations.