Previous | Next | Trail Map | Creating a User Interface | Table of Contents


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(in the Creating a User Interface trail) , especially The Anatomy of a GUI-Based Program.

Overview of Using Graphics

[An overview of the AWT support for drawing. Introduction to the Graphics object. paint() and update(). Canvas. Intro to images, animation.]

Using Graphics Primitives

[How to draw simple shapes, display text.]

Using Images

[How to load, display, and manipulate images. Discuss MediaTracker.]

Performing Animation

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.

Common Graphics Problems (and Their Solutions)

Please send suggestions for this section to me.


Previous | Next | Trail Map | Creating a User Interface | Table of Contents