public final class PageAttributes extends Object implements Cloneable
このクラスのインスタンスは、色の状態、用紙サイズ(メディアの種類)、用紙方向、論理的な原点、印刷品質、およびインスタンスを使用する各ページの解像度を制御します。 属性名は、可能な場合Internet Printing Protocol (IPP) 1.1に準拠しています。 属性値は可能な場合、部分的に準拠しています。
内部クラス型をとるメソッドを使用するには、その内部クラスの定数フィールドに対する参照を渡します。 クライアント・コードは、このクラスがpublicコンストラクタを持たないため、内部クラス型の新規インスタンスを作成できません。 色の状態をモノクロに設定するには、次のコードを使用します。
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) |
2つの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) |
これらの属性を使用するページの前後送りまたは送りの印刷解像度を1インチ当たりのドット数で指定します。
|
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.PRINTABLEprintQuality - PrintQualityType.DRAFT、PrintQualityType.NORMAL、またはPrintQualityType.HIGHprinterResolution - 3要素の整数配列。 最初の要素は、0より大きいことが必要です。 2番目の要素は、0より大きいことが必要です。 3番目の要素は、3または4のどちらかである必要があります。 IllegalArgumentException - 上の条件の1つ以上に違反した場合。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 - 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または4IllegalArgumentException - orientationRequestedが3または4でない場合public void setOrientationRequestedToDefault()
public PageAttributes.OriginType getOrigin()
public void setOrigin(PageAttributes.OriginType origin)
origin - OriginType.PHYSICALまたはOriginType.PRINTABLEIllegalArgumentException - originがnullの場合。public PageAttributes.PrintQualityType getPrintQuality()
public void setPrintQuality(PageAttributes.PrintQualityType printQuality)
printQuality - PrintQualityType.DRAFT、PrintQualityType.NORMAL、またはPrintQualityType.HIGHIllegalArgumentException - printQualityがnullの場合。public void setPrintQuality(int printQuality)
3を指定するとドラフト、 4を指定すると通常、 5を指定すると高品質になります。 ほかの値を指定するとIllegalArgumentExceptionがスローされます。 プロパティで指定しない場合は、setPrintQuality(PrintQualityType.NORMAL)が呼び出されます。 printQuality - 3、4、または5IllegalArgumentException - printQualityが3 、4、または5でない場合public void setPrintQualityToDefault()
public int[] getPrinterResolution()
3は、1インチ当たりのドット数を示します。4は、1センチ当たりのドット数を示します。 3または4のどちらかである必要があります。 public void setPrinterResolution(int[] printerResolution)
3は、1インチ当たりのドット数を示します。4は、1センチ当たりのドット数を示します。 1.1印刷実装(Toolkit.getPrintJob)では、送り方向の解像度と前後送りの解像度は同じである必要があります。 プロパティで指定しない場合は、setPrinterResolution(72)が呼び出されます。 printerResolution - 3要素の整数配列。 最初の要素は、0より大きいことが必要です。 2番目の要素は、0より大きいことが必要です。 3番目の要素は、3または4のどちらかである必要があります。 IllegalArgumentException - 上の条件の1つ以上に違反した場合。public void setPrinterResolution(int printerResolution)
72が指定されます。 printerResolution - 0より大きい整数。IllegalArgumentException - printerResolutionが0以下の場合。public void setPrinterResolutionToDefault()
public boolean equals(Object obj)
お互いの属性がすべて同じである場合にだけ、2つのPageAttributesは等しくなります。 フィールドが一意の同じ列挙オブジェクトを参照している場合にだけ、列挙型の属性が等しくなります。 つまり、別名のメディアは、元になる一意のメディアと同じであるということです。 送り解像度、前後送り解像度および単位が同じである場合にだけ、プリンタの解像度が等しくなります。
equals、クラスObjectobj - 同じであるかどうかがチェックされるオブジェクト。Object.hashCode(), HashMappublic int hashCode()
hashCode、クラスObjectObject.equals(java.lang.Object), System.identityHashCode(java.lang.Object) バグまたは機能を送信
詳細なAPIリファレンスおよび開発者ドキュメントについては、Java SEのドキュメントを参照してください。 そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright © 1993, 2025, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Documentation Redistribution Policyも参照してください。