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发行说明。
Since the Java 2D API enables you to draw on any surface, a natural extension of that is the ability to print Java 2D graphics. 由于Java2D API使您能够在任何曲面上绘制,因此它的一个自然扩展是打印Java2D图形的能力。A printer can be considered a graphics device just like a display.打印机可以像显示器一样被视为图形设备。
The Java 2D printing API is not limited to printing graphics. Java 2D打印API不限于打印图形。It enables you to print the content of an application's user interface as well. 它还允许您打印应用程序用户界面的内容。Content can be printed by sending raw data to the printer under the formatting control of the Java 2D printing API, or by using the Java 2D Graphics API.可以通过在Java 2D打印API的格式控制下向打印机发送原始数据或使用Java 2D图形API来打印内容。
In this lesson you will explore the printer and job control functions of the Java 2D printing API which are complements to the rendering elements. 在本课程中,您将探索Java 2D打印API的打印机和作业控制功能,这些功能是对渲染元素的补充。You will learn how to look up printers configured on the system or network and discover information about these printers such as the paper sizes it supports, and selecting these attributes for printing, and user dialogs.您将学习如何查找在系统或网络上配置的打印机,以及如何查找有关这些打印机的信息,例如打印机支持的纸张尺寸,以及如何选择这些属性进行打印,以及如何使用用户对话框。
The main classes and interfaces involved in printing are represented in the 打印中涉及的主要类和接口在java.awt.print
and javax.print
packages (the last package allows you to get access to the printing services).java.awt.print
和javax.print
包中表示(最后一个包允许您访问打印服务)。
The basic printing operations are represented in the following sections:以下各节介绍了基本打印操作:
Printable
interface and presents a basic printing program.Printable
接口,并介绍基本打印程序。javax.print
package.javax.print
包创建打印作业。Swing
and refers to specific Swing
classes and interfaces.Swing
中的相关打印功能,并介绍特定的Swing
类和接口。