Previous | Next | Trail Map | 2D Graphics | Contents

2D Graphics

by Deborah Adair


Your feedback is important to us! Please send comments about this trail to: tutorial@java.sun.com. In your message, place 2D in the subject header.
This trail introduces you to the Java 2D API and shows you how to display and print 2D graphics in your Java programs. The Java 2D API enables you to easily For example, you could use the Java 2D API to display complex charts and graphs that use various line and fill styles to distinguish sets of data, like those shown in the following figure.

The Java 2D API also enables you to store and to manipulate image data--for example, you can easily perform image-filter operations, such as blur and sharpen, as shown in the following figure.

This trail covers the most common uses of the Java 2D APIs and briefly describes some of the more advanced features. For additional information about using the Java 2D APIs, see the Java 2D Programmer's Guide. Additional sample programs illustrating the Java 2D API features are also available online.


Note: The sample applets in this trail can be run with the JDK 1.2 Applet Viewer, a browser with Java Plug-in 1.2 installed, or a JDK 1.2 compatible browser.
The Java 2D APIs are closely integrated with the Abstract Windowing Toolkit (AWT). If you are not familiar with AWT, you might find it useful to review the AWT documentation, which you can download.

Overview of the Java 2D API introduces the key Java 2D concepts and describes the Java 2D rendering model.

Displaying Graphics with Graphics2D teaches you how to set up the Graphics2D rendering context to use fancy stroke and fill styles, perform transformations, clip the drawing region, composite overlapping graphics, and specify rendering preferences.

Manipulating and Displaying Images his lesson explains how to implement double buffering and how to perform image-filter operations with BufferedImage objects.

Printing teaches you how to render 2D graphics to a printer and how to print complex documents.


Previous | Next | Trail Map | 2D Graphics | Contents