Sun Certification Training Guide (310-025, 310-027): Java™ 2 Programmer and Developer Exams
by Jamie Jaworski
The Canvas and Graphics Classes
The Canvas class of java.awt provides a general GUI component (it extends Component) for drawing images and text (or anything else) on the screen. It does not support drawing methods of its own, but it does provide access to a Graphics object via its paint() method.
The paint() method is invoked upon the creation and update of a Canvas object. The paint() method enables the Graphics object that is associated with the Canvas object to be updated. This method should not be directly invoked, but it can be indirectly accessed using the repaint() method. The AWT creates a background thread that automatically causes the paint() methods of Canvas, Frame, Panel, Applet, and other GUI components as required to update areas ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access