Java 教程是为 JDK 8 编写的。本页中描述的示例和实践未利用在后续版本中引入的改进。
This trail introduces you to the Java 2D™ API and shows you how to display and print 2D graphics in your Java programs. The trail is intended for developers who want to enrich their knowledge of the Java 2D API, as well as for beginners in computer graphics. Almost every section contains relevant examples to illustrate specific capabilities. The Java 2D API enables you to easily perform the following tasks:
This chapter also explains less familiar concepts such as compositing.
This chapter describes the concept of drawing on-screen and off-screen images, as well as surfaces and printer devices. This trail covers the most common uses of the Java 2D APIs and briefly describes some of the more advanced features.
Overview of the Java 2D Graphics APIintroduces the key Java 2D concepts and describes the Java 2D rendering model. This lesson is more conceptual than other lessons of this trail, it enables you to get deep into basic notions and classes descriptions.
Getting started with Graphicsuses a developed example to show you how to obtain a Graphics object and use it for common graphics rendering tasks.
使用几何teaches you how to use APIs to draw graphic primitives and arbitrary shapes, and how to apply fancy strokes and fill styles.
使用文本 APIshows you how to effectively use text APIs, including how to create a Font
object with desired attributes, measure text, and determine the names of the fonts available on your system.
使用图像explains how to create a BufferedImage object, perform image-filtering operations, and draw on an image.
打印teaches you how to render 2D graphics to a printer, print complex documents, and use Print Services.
Advanced topics in Java 2Dexplains how to perform transformations, clip the drawing region, composite overlapping graphics, specify rendering preferences, and control rendering quality.