public final class PageAttributes extends Object implements Cloneable
这个类的实例控制颜色状态,纸张大小(媒体类型),方向,逻辑原点,打印质量,以及使用实例的每一个页面的分辨率。属性名是符合互联网打印协议(IPP)1.1可能。属性值在可能的情况下部分兼容。
要使用一个方法,它需要一个内部类类型,通过引用一个内部类的常量字段。客户端代码无法创建内部类类型的新实例,因为这些类中没有一个有公共构造函数。例如,要将颜色状态设置为单色,使用下面的代码:
进口java.awt.pageattributes;公共课monochromeexample {公共无效setmonochrome(PageAttributes pageAttributes){pageattributes。设置颜色(pageattributes。颜色类型。单色);}}
每一个IPP属性支持空属性-默认值有相应的setattributeNameToDefault
方法。未提供默认值字段。
Modifier and Type | Class and Description |
---|---|
static class |
PageAttributes.ColorType
一种可能的颜色状态的类型安全枚举。
|
static class |
PageAttributes.MediaType
一种可能的纸张尺寸的类型安全枚举。
|
static class |
PageAttributes.OrientationRequestedType
一种可能的方向的类型安全枚举。
|
static class |
PageAttributes.OriginType
一种可能的起源的类型安全枚举。
|
static class |
PageAttributes.PrintQualityType
打印质量可能的打印质量的类型安全枚举。
|
Constructor and Description |
---|
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。
|
Modifier and Type | Method and Description |
---|---|
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属性相同的值作为对象的属性。
|
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。
|
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.printable
printQuality
- printqualitytype.draft,PrintQualityType.NORMAL,或printqualitytype.high
printerResolution
- 3行一个整数数组。第一个元素必须大于0。必须大于0的第二个元素。第三元必须是
3
或
4
。
IllegalArgumentException
如果上述一个或多个条件被违反。
public Object clone()
public void set(PageAttributes obj)
obj
-复制pageattributes。
public PageAttributes.ColorType getColor()
public void setColor(PageAttributes.ColorType color)
color
- colortype.color或colortype.monochrome。
IllegalArgumentException
如果色是空的。
public PageAttributes.MediaType getMedia()
public void setMedia(PageAttributes.MediaType media)
media
之一MediaType类的常量字段。
IllegalArgumentException
如果媒体是空的。
public void setMediaToDefault()
public PageAttributes.OrientationRequestedType getOrientationRequested()
public void setOrientationRequested(PageAttributes.OrientationRequestedType orientationRequested)
orientationRequested
- OrientationRequestedType.PORTRAIT或orientationrequestedtype.landscape。
IllegalArgumentException
-如果orientationrequested是空的。
public void setOrientationRequested(int orientationRequested)
3
表示肖像。指定
4
表示景观。指定任何其他值将产生一个时。没有指定的属性相当于调用setorientationrequested(orientationrequestedtype。画像)。
orientationRequested
-
3
或
4
IllegalArgumentException
-如果orientationrequested不
3
或
4
public void setOrientationRequestedToDefault()
public PageAttributes.OriginType getOrigin()
public void setOrigin(PageAttributes.OriginType origin)
origin
- origintype.physical或origintype.printable
IllegalArgumentException
如果起源是空的。
public PageAttributes.PrintQualityType getPrintQuality()
public void setPrintQuality(PageAttributes.PrintQualityType printQuality)
printQuality
- printqualitytype.draft,PrintQualityType.NORMAL,或printqualitytype.high
IllegalArgumentException
-如果printquality是空的。
public void setPrintQuality(int printQuality)
3
表示草案。指定
4
表示正常。指定
5
表示高。指定任何其他值将产生一个时。没有指定的属性相当于调用setprintquality(printqualitytype。正常)。
printQuality
-
3
,
4
,或
5
IllegalArgumentException
-如果printquality不
3
,
4
,或
5
public void setPrintQualityToDefault()
public int[] getPrinterResolution()
3
表示每英寸点数。
4
表示点每厘米。
3
或
4
。
public void setPrinterResolution(int[] printerResolution)
3
表示每英寸点数。
4
表示点每厘米。注:1.1打印的实现(工具包。getprintjob)要求进给和横向进给分辨率是相同的。没有指定的属性相当于调用setprinterresolution(72)。
printerResolution
- 3行一个整数数组。第一个元素必须大于0。必须大于0的第二个元素。第三元必须是
3
或
4
。
IllegalArgumentException
如果上述一个或多个条件被违反。
public void setPrinterResolution(int printerResolution)
72
。
printerResolution
-大于0的整数。
IllegalArgumentException
-如果printerresolution小于或等于0。
public void setPrinterResolutionToDefault()
public boolean equals(Object obj)
两pageattributes相等当且仅当它们的属性都是平等的。当且仅当字段引用同一个唯一枚举对象时,枚举类型的属性是相等的。这意味着,别名的媒体等于其潜在的独特的媒体。打印机分辨率是相等的,如果和只有当饲料分辨率,交叉饲料分辨率,单位是平等的。
equals
方法重写,继承类
Object
obj
的平等将被检查的对象。
Object.hashCode()
,
HashMap
public int hashCode()
hashCode
方法重写,继承类
Object
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.