| 
JavaTM 2 Platform Standard Ed. 5.0  | 
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjava.awt.PageAttributes
public final class PageAttributes
用来控制打印页面输出的属性集。
此类的实例控制颜色状态、纸张尺寸(介质类型)、打印方向、逻辑原点、打印质量,以及使用实例的每个页面的分辨率。属性名尽可能遵守 Internet Printing Protocol (IPP) 1.1。属性值要尽可能部分地遵守该协议。
要使用采用内部类类型的方法,需要将引用传递给内部类的常量字段之一。客户端代码无法创建内部类类型的新实例,因为这些类都不具有公共构造方法。例如,为了将颜色状态设置为单色,需要使用以下代码:
 import java.awt.PageAttributes;
 public class MonochromeExample {
     public void setMonochrome(PageAttributes pageAttributes) {
         pageAttributes.setColor(PageAttributes.ColorType.MONOCHROME);
     }
 }
 
 
每个支持 attributeName(默认值)的 IPP 属性均有一个对应的 setattributeNameToDefault 方法。未提供默认值字段。
| 嵌套类摘要 | |
|---|---|
static class | 
PageAttributes.ColorType
可能颜色状态的类型安全的枚举。  | 
static class | 
PageAttributes.MediaType
可能的纸张大小的类型安全的枚举。  | 
static class | 
PageAttributes.OrientationRequestedType
可能打印方向的类型安全的枚举。  | 
static class | 
PageAttributes.OriginType
可能原点的类型安全的枚举。  | 
static class | 
PageAttributes.PrintQualityType
可能的打印质量的类型安全的枚举。  | 
| 构造方法摘要 | |
|---|---|
PageAttributes()
构造一个具有每个属性的默认值的 PageAttributes 实例。  | 
|
PageAttributes(PageAttributes.ColorType color,
               PageAttributes.MediaType media,
               PageAttributes.OrientationRequestedType orientationRequested,
               PageAttributes.OriginType origin,
               PageAttributes.PrintQualityType printQuality,
               int[] printerResolution)
构造一个具有每个属性的指定值的 PageAttributes 实例。  | 
|
PageAttributes(PageAttributes obj)
构造一个 PageAttributes 实例,它是所提供的 PageAttributes 的副本。  | 
|
| 方法摘要 | |
|---|---|
 Object | 
clone()
创建并返回此 PageAttributes 的一个副本。  | 
 boolean | 
equals(Object obj)
确定两个 PageAttributes 是否相等。  | 
 PageAttributes.ColorType | 
getColor()
返回使用这些属性的页面是以彩色呈现,还是以单色呈现。  | 
 PageAttributes.MediaType | 
getMedia()
返回使用这些属性的页面的纸张尺寸。  | 
 PageAttributes.OrientationRequestedType | 
getOrientationRequested()
返回使用这些属性的页面的打印方向。  | 
 PageAttributes.OriginType | 
getOrigin()
返回在使用这些属性的页面上的 (0, 0) 绘制的起始位置,即是从逻辑页面的左上角开始绘制,还是从可打印区域的左上角开始绘制。  | 
 int[] | 
getPrinterResolution()
返回使用这些属性的页面的打印分辨率。  | 
 PageAttributes.PrintQualityType | 
getPrintQuality()
返回使用这些属性的页面的打印质量。  | 
 int | 
hashCode()
返回此 PageAttributes 的哈希码值。  | 
 void | 
set(PageAttributes obj)
将此 PageAttributes 的所有属性设置为与 obj 的属性相同的值。  | 
 void | 
setColor(PageAttributes.ColorType color)
指定使用这些属性的页面以彩色呈现,还是以单色呈现。  | 
 void | 
setMedia(PageAttributes.MediaType media)
指定使用这些属性的页面所需的纸张尺寸。  | 
 void | 
setMediaToDefault()
将使用这些属性的页面的纸张尺寸设置为默认地区的默认尺寸。  | 
 void | 
setOrientationRequested(int orientationRequested)
指定使用这些属性的页面的打印方向。  | 
 void | 
setOrientationRequested(PageAttributes.OrientationRequestedType orientationRequested)
指定使用这些属性的页面的打印方向。  | 
 void | 
setOrientationRequestedToDefault()
将使用这些属性的页面的打印方向设置为默认值。  | 
 void | 
setOrigin(PageAttributes.OriginType origin)
指定在使用这些属性的页面上的 (0, 0) 绘制的起始位置,即是从逻辑页面的左上角开始绘制,还是从可打印区域的左上角开始绘制。  | 
 void | 
setPrinterResolution(int printerResolution)
指定使用这些属性的页面所需的反向进纸和进纸的打印分辨率,分辨率以每英寸的点数为单位。  | 
 void | 
setPrinterResolution(int[] printerResolution)
指定使用这些属性的页面所需的打印分辨率。  | 
 void | 
setPrinterResolutionToDefault()
将使用这些属性的页面的打印机分辨率设置为默认值。  | 
 void | 
setPrintQuality(int printQuality)
指定使用这些属性的页面的打印质量。  | 
 void | 
setPrintQuality(PageAttributes.PrintQualityType printQuality)
指定使用这些属性的页面的打印质量。  | 
 void | 
setPrintQualityToDefault()
将使用这些属性的页面的打印质量设置为默认值。  | 
 String | 
toString()
返回此 PageAttributes 的字符串表示形式。  | 
| 从类 java.lang.Object 继承的方法 | 
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait | 
| 构造方法详细信息 | 
|---|
public PageAttributes()
public PageAttributes(PageAttributes obj)
obj - 要复制的 PageAttributes。
public PageAttributes(PageAttributes.ColorType color,
                      PageAttributes.MediaType media,
                      PageAttributes.OrientationRequestedType orientationRequested,
                      PageAttributes.OriginType origin,
                      PageAttributes.PrintQualityType printQuality,
                      int[] printerResolution)
color - ColorType.COLOR 或 ColorType.MONOCHROME。media - MediaType 类的常数字段之一。orientationRequested - OrientationRequestedType.PORTRAIT 或 OrientationRequestedType.LANDSCAPE。origin - OriginType.PHYSICAL 或 OriginType.PRINTABLEprintQuality - PrintQualityType.DRAFT、PrintQualityType.NORMAL 或 PrintQualityType.HIGHprinterResolution - 3 个元素的整数数组。第一、二个元素必须大于 0,第三个元素必须为 3 或 4。
IllegalArgumentException - 如果违反了一个或多个上述条件。| 方法详细信息 | 
|---|
public Object clone()
Object 中的 cloneCloneablepublic void set(PageAttributes obj)
obj - 要复制的 PageAttributes。public PageAttributes.ColorType getColor()
public void setColor(PageAttributes.ColorType color)
color - ColorType.COLOR 或 ColorType.MONOCHROME。
IllegalArgumentException - 如果 color 为 null。public PageAttributes.MediaType getMedia()
public void setMedia(PageAttributes.MediaType media)
media - MediaType 类的常数字段之一。
IllegalArgumentException - 如果 media 为 null。public void setMediaToDefault()
public PageAttributes.OrientationRequestedType getOrientationRequested()
public void setOrientationRequested(PageAttributes.OrientationRequestedType orientationRequested)
orientationRequested - OrientationRequestedType.PORTRAIT 或 OrientationRequestedType.LANDSCAPE。
IllegalArgumentException - 如果 orientationRequested 为 null。public void setOrientationRequested(int orientationRequested)
3 表示纵向打印。指定 4 表示横向打印。指定任何其他值将生成 IllegalArgumentException。如果不指定此属性,则默认调用 setOrientationRequested(OrientationRequestedType.PORTRAIT)。
orientationRequested - 3 或 4
IllegalArgumentException - 如果 orientationRequested 不为 3 或 4public void setOrientationRequestedToDefault()
public PageAttributes.OriginType getOrigin()
public void setOrigin(PageAttributes.OriginType origin)
origin - OriginType.PHYSICAL 或 OriginType.PRINTABLE
IllegalArgumentException - 如果 origin 为 null。public PageAttributes.PrintQualityType getPrintQuality()
public void setPrintQuality(PageAttributes.PrintQualityType printQuality)
printQuality - PrintQualityType.DRAFT、PrintQualityType.NORMAL 或 PrintQualityType.HIGH
IllegalArgumentException - 如果 printQuality 为 null。public void setPrintQuality(int printQuality)
3 表示草稿质量。指定 4 表示标准质量。指定 5 表示高质量。指定任何其他值都将会生成 IllegalArgumentException。如果不指定此属性,则调用 setPrintQuality(PrintQualityType.NORMAL)。
printQuality - 3、4 或 5
IllegalArgumentException - 如果 printQuality 不为      3、4 或 5public void setPrintQualityToDefault()
public int[] getPrinterResolution()
3 表示以每英寸的点数为单位。4 表示以每厘米的点数为单位。
3 或 4。public void setPrinterResolution(int[] printerResolution)
3 表示以每英寸的点数为单位。4 表示以每厘米的点数为单位。注意,1.1 打印实现 (Toolkit.getPrintJob) 要求进纸和反向进纸具有相同的分辨率。如果不指定此属性,则调用 setPrinterResolution(72)。
printerResolution - 3 个元素的整数数组。第一、二个元素必须大于 0,第三个元素必须为 3 或 4。
IllegalArgumentException - 如果违反了一个或多个上述条件。public void setPrinterResolution(int printerResolution)
72。
printerResolution - 大于 0 的整数。
IllegalArgumentException - 如果 printerResolution 小于或等于 0。public void setPrinterResolutionToDefault()
public boolean equals(Object obj)
当且仅当两个 PageAttributes 的每个属性均相等时,它们才是相等的。当且仅当字段的引用指向相同的惟一枚举对象时,枚举类型的属性才是相等的。这意味着一个有别名的 media 等效于基础的惟一 media。当且仅当进纸分辨率、反向进纸分辨率和单位相等时,打印机分辨率才是相等的。
Object 中的 equalsobj - 将检查其相等性的对象。
Object.hashCode(), 
Hashtablepublic int hashCode()
Object 中的 hashCodeObject.equals(java.lang.Object), 
Hashtablepublic String toString()
Object 中的 toString
  | 
JavaTM 2 Platform Standard Ed. 5.0  | 
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。