Previous | Next | Trail Map | Creating a User Interface (AWT Only) | Contents

Working with Graphics

This lesson teaches you everything you need to make your program draw to the screen. You'll learn how to create simple geometric shapes, display text, and display 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 AWT Graphics Support

This page gives an overview of the AWT support for drawing, with links to where you can find more information.

Using Graphics Primitives

This section teaches you how to draw simple shapes and display text effectively. It includes examples of using the Graphics, Font, and FontMetrics classes. One rectangle-drawing example could be used as the basis for implementing selection in a paint program.

Using Images

This section discusses the Java support for images and tells you how to load, display, and manipulate images.

Performing Animation

Many Java programs (especially applets) perform animation, whether it's the classic, cartoon-style animation of Duke waving (visible in the first page of Getting Started(in the Getting Started trail)), program-generated graphics such as a scrolling checkerboard, or simply moving static images across the screen. This section tells you how to perform animation well. It includes tips on improving graphics performance and appearance, using techniques such as implementing the update() method and double buffering.

Common Graphics Problems (and Their Solutions)

This section describes some common problems of graphics programs, along with possible solutions to these problems.


Previous | Next | Trail Map | Creating a User Interface (AWT Only) | Contents