The Java Tutorials have been written for JDK 8.Java教程是为JDK 8编写的。Examples and practices described in this page don't take advantage of improvements introduced in later releases and might use technology no longer available.本页中描述的示例和实践没有利用后续版本中引入的改进,并且可能使用不再可用的技术。See Java Language Changes for a summary of updated language features in Java SE 9 and subsequent releases.有关Java SE 9及其后续版本中更新的语言特性的摘要,请参阅Java语言更改。
See JDK Release Notes for information about new features, enhancements, and removed or deprecated options for all JDK releases.有关所有JDK版本的新功能、增强功能以及已删除或不推荐的选项的信息,请参阅JDK发行说明。
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.以下各节将讨论这些主题。
This section explains how to create standard shapes such as points, lines, curves, arcs, rectangles, and ellipses.本节介绍如何创建标准形状,如点、线、曲线、圆弧、矩形和椭圆。
This section explains how to draw shapes represented by combinations of straight geometric primitives by using the 本节介绍如何使用GeneralPath
class.GeneralPath
类绘制由直线几何图元组合表示的形状。
This section explains how to set the stroke and paint attributes to control the outline and fill styles applied to 本节介绍如何设置笔划和绘制属性,以控制应用于形状对象和文本的轮廓和填充样式。Shape
objects and text.