Documentation

The Java™ Tutorials
Hide TOC
Working with Geometry使用几何图形
Trail: 2D Graphics

Lesson: Working with Geometry课程:使用几何图形

In prior lessons, you have learned the graphics concept, including basic information about the coordinate system and graphic object creation.在前面的课程中,您已经学习了图形概念,包括有关坐标系和图形对象创建的基本信息。Now, you will progress to more detailed lessons about the 2D graphics classes.现在,您将学习有关2D图形类的更详细课程。This lesson shows you how to use the Graphics2D class to draw graphic primitives as well as arbitrary shapes, and how to display graphics with fancy outline and fill styles.本课程介绍如何使用Graphics2D类绘制图形基本体和任意形状,以及如何显示具有奇特轮廓和填充样式的图形。These topics are discussed in the following sections.以下各节将讨论这些主题。

Drawing Geometric Primitives绘制几何图元

This section explains how to create standard shapes such as points, lines, curves, arcs, rectangles, and ellipses.本节介绍如何创建标准形状,如点、线、曲线、圆弧、矩形和椭圆。

Drawing Arbitrary Shapes绘制任意形状

This section explains how to draw shapes represented by combinations of straight geometric primitives by using the GeneralPath class.本节介绍如何使用GeneralPath类绘制由直线几何图元组合表示的形状。

Filling and Stroking填充和描边

This section explains how to set the stroke and paint attributes to control the outline and fill styles applied to Shape objects and text.本节介绍如何设置笔划和绘制属性,以控制应用于形状对象和文本的轮廓和填充样式。


Previous page: Previous Lesson
Next page: Drawing Geometric Primitives