Working with Graphics
This lesson will tell you
how to make your program draw to the screen
(and to any other display device, such as a printer).
You'll learn how to create simple geometric shapes,
display text,
and display pre-existing images.
Then you'll learn how to animate these shapes and images.
This lesson assumes that you've read the
Overview of the Java UI
, especially
The Anatomy of a GUI-Based Program.
[An overview of the AWT support for drawing.
Introduction to the Graphics object.
paint() and update().
Canvas.
Intro to images, animation.]
[How to draw simple shapes, display text.]
[How to load, display, and manipulate images.
Discuss MediaTracker.]
Many Java programs (especially applets) perform animation of some sort.
It can range from the classic, cartoon-style animation of Duke waving
(which you can see in the Trail Map)
to generated graphics (such as a flowing sine wave)
to simply moving an image across the screen.
This section will tell you how to perform animation well.
It includes tips on improving graphics performance and appearance,
using techniques such as
double buffering and implementing the update() method.
Please send suggestions for this section to
me.