java.awt
Class PageAttributes

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.awt.PageAttributes
All Implemented Interfaces:
Cloneable sample code for java.lang.Cloneable definition code for java.lang.Cloneable

public final class PageAttributes
extends Object sample code for java.lang.Object definition code for java.lang.Object
implements Cloneable sample code for java.lang.Cloneable definition code for java.lang.Cloneable

A set of attributes which control the output of a printed page.

Instances of this class control the color state, paper size (media type), orientation, logical origin, print quality, and resolution of every page which uses the instance. Attribute names are compliant with the Internet Printing Protocol (IPP) 1.1 where possible. Attribute values are partially compliant where possible.

To use a method which takes an inner class type, pass a reference to one of the constant fields of the inner class. Client code cannot create new instances of the inner class types because none of those classes has a public constructor. For example, to set the color state to monochrome, use the following code:

 import java.awt.PageAttributes;

 public class MonochromeExample {
     public void setMonochrome(PageAttributes pageAttributes) {
         pageAttributes.setColor(PageAttributes.ColorType.MONOCHROME);
     }
 }
 

Every IPP attribute which supports an attributeName-default value has a corresponding setattributeNameToDefault method. Default value fields are not provided.


Nested Class Summary
static class PageAttributes.ColorType sample code for java.awt.PageAttributes.ColorType definition code for java.awt.PageAttributes.ColorType
          A type-safe enumeration of possible color states.
static class PageAttributes.MediaType sample code for java.awt.PageAttributes.MediaType definition code for java.awt.PageAttributes.MediaType
          A type-safe enumeration of possible paper sizes.
static class PageAttributes.OrientationRequestedType sample code for java.awt.PageAttributes.OrientationRequestedType definition code for java.awt.PageAttributes.OrientationRequestedType
          A type-safe enumeration of possible orientations.
static class PageAttributes.OriginType sample code for java.awt.PageAttributes.OriginType definition code for java.awt.PageAttributes.OriginType
          A type-safe enumeration of possible origins.
static class PageAttributes.PrintQualityType sample code for java.awt.PageAttributes.PrintQualityType definition code for java.awt.PageAttributes.PrintQualityType
          A type-safe enumeration of possible print qualities.
 
Constructor Summary
PageAttributes sample code for java.awt.PageAttributes.PageAttributes() definition code for java.awt.PageAttributes.PageAttributes() ()
          Constructs a PageAttributes instance with default values for every attribute.
PageAttributes sample code for java.awt.PageAttributes.PageAttributes(java.awt.PageAttributes.ColorType, java.awt.PageAttributes.MediaType, java.awt.PageAttributes.OrientationRequestedType, java.awt.PageAttributes.OriginType, java.awt.PageAttributes.PrintQualityType, int[]) definition code for java.awt.PageAttributes.PageAttributes(java.awt.PageAttributes.ColorType, java.awt.PageAttributes.MediaType, java.awt.PageAttributes.OrientationRequestedType, java.awt.PageAttributes.OriginType, java.awt.PageAttributes.PrintQualityType, int[]) (PageAttributes.ColorType sample code for java.awt.PageAttributes.ColorType definition code for java.awt.PageAttributes.ColorType  color, PageAttributes.MediaType sample code for java.awt.PageAttributes.MediaType definition code for java.awt.PageAttributes.MediaType  media, PageAttributes.OrientationRequestedType sample code for java.awt.PageAttributes.OrientationRequestedType definition code for java.awt.PageAttributes.OrientationRequestedType  orientationRequested, PageAttributes.OriginType sample code for java.awt.PageAttributes.OriginType definition code for java.awt.PageAttributes.OriginType  origin, PageAttributes.PrintQualityType sample code for java.awt.PageAttributes.PrintQualityType definition code for java.awt.PageAttributes.PrintQualityType  printQuality, int[] printerResolution)
          Constructs a PageAttributes instance with the specified values for every attribute.
PageAttributes sample code for java.awt.PageAttributes.PageAttributes(java.awt.PageAttributes) definition code for java.awt.PageAttributes.PageAttributes(java.awt.PageAttributes) (PageAttributes sample code for java.awt.PageAttributes definition code for java.awt.PageAttributes  obj)
          Constructs a PageAttributes instance which is a copy of the supplied PageAttributes.
 
Method Summary
 Object sample code for java.lang.Object definition code for java.lang.Object clone sample code for java.awt.PageAttributes.clone() definition code for java.awt.PageAttributes.clone() ()
          Creates and returns a copy of this PageAttributes.
 boolean equals sample code for java.awt.PageAttributes.equals(java.lang.Object) definition code for java.awt.PageAttributes.equals(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  obj)
          Determines whether two PageAttributes are equal to each other.
 PageAttributes.ColorType sample code for java.awt.PageAttributes.ColorType definition code for java.awt.PageAttributes.ColorType getColor sample code for java.awt.PageAttributes.getColor() definition code for java.awt.PageAttributes.getColor() ()
          Returns whether pages using these attributes will be rendered in color or monochrome.
 PageAttributes.MediaType sample code for java.awt.PageAttributes.MediaType definition code for java.awt.PageAttributes.MediaType getMedia sample code for java.awt.PageAttributes.getMedia() definition code for java.awt.PageAttributes.getMedia() ()
          Returns the paper size for pages using these attributes.
 PageAttributes.OrientationRequestedType sample code for java.awt.PageAttributes.OrientationRequestedType definition code for java.awt.PageAttributes.OrientationRequestedType getOrientationRequested sample code for java.awt.PageAttributes.getOrientationRequested() definition code for java.awt.PageAttributes.getOrientationRequested() ()
          Returns the print orientation for pages using these attributes.
 PageAttributes.OriginType sample code for java.awt.PageAttributes.OriginType definition code for java.awt.PageAttributes.OriginType getOrigin sample code for java.awt.PageAttributes.getOrigin() definition code for java.awt.PageAttributes.getOrigin() ()
          Returns whether drawing at (0, 0) to pages using these attributes draws at the upper-left corner of the physical page, or at the upper-left corner of the printable area.
 int[] getPrinterResolution sample code for java.awt.PageAttributes.getPrinterResolution() definition code for java.awt.PageAttributes.getPrinterResolution() ()
          Returns the print resolution for pages using these attributes.
 PageAttributes.PrintQualityType sample code for java.awt.PageAttributes.PrintQualityType definition code for java.awt.PageAttributes.PrintQualityType getPrintQuality sample code for java.awt.PageAttributes.getPrintQuality() definition code for java.awt.PageAttributes.getPrintQuality() ()
          Returns the print quality for pages using these attributes.
 int hashCode sample code for java.awt.PageAttributes.hashCode() definition code for java.awt.PageAttributes.hashCode() ()
          Returns a hash code value for this PageAttributes.
 void set sample code for java.awt.PageAttributes.set(java.awt.PageAttributes) definition code for java.awt.PageAttributes.set(java.awt.PageAttributes) (PageAttributes sample code for java.awt.PageAttributes definition code for java.awt.PageAttributes  obj)
          Sets all of the attributes of this PageAttributes to the same values as the attributes of obj.
 void setColor sample code for java.awt.PageAttributes.setColor(java.awt.PageAttributes.ColorType) definition code for java.awt.PageAttributes.setColor(java.awt.PageAttributes.ColorType) (PageAttributes.ColorType sample code for java.awt.PageAttributes.ColorType definition code for java.awt.PageAttributes.ColorType  color)
          Specifies whether pages using these attributes will be rendered in color or monochrome.
 void setMedia sample code for java.awt.PageAttributes.setMedia(java.awt.PageAttributes.MediaType) definition code for java.awt.PageAttributes.setMedia(java.awt.PageAttributes.MediaType) (PageAttributes.MediaType sample code for java.awt.PageAttributes.MediaType definition code for java.awt.PageAttributes.MediaType  media)
          Specifies the desired paper size for pages using these attributes.
 void setMediaToDefault sample code for java.awt.PageAttributes.setMediaToDefault() definition code for java.awt.PageAttributes.setMediaToDefault() ()
          Sets the paper size for pages using these attributes to the default size for the default locale.
 void setOrientationRequested sample code for java.awt.PageAttributes.setOrientationRequested(int) definition code for java.awt.PageAttributes.setOrientationRequested(int) (int orientationRequested)
          Specifies the print orientation for pages using these attributes.
 void setOrientationRequested sample code for java.awt.PageAttributes.setOrientationRequested(java.awt.PageAttributes.OrientationRequestedType) definition code for java.awt.PageAttributes.setOrientationRequested(java.awt.PageAttributes.OrientationRequestedType) (PageAttributes.OrientationRequestedType sample code for java.awt.PageAttributes.OrientationRequestedType definition code for java.awt.PageAttributes.OrientationRequestedType  orientationRequested)
          Specifies the print orientation for pages using these attributes.
 void setOrientationRequestedToDefault sample code for java.awt.PageAttributes.setOrientationRequestedToDefault() definition code for java.awt.PageAttributes.setOrientationRequestedToDefault() ()
          Sets the print orientation for pages using these attributes to the default.
 void setOrigin sample code for java.awt.PageAttributes.setOrigin(java.awt.PageAttributes.OriginType) definition code for java.awt.PageAttributes.setOrigin(java.awt.PageAttributes.OriginType) (PageAttributes.OriginType sample code for java.awt.PageAttributes.OriginType definition code for java.awt.PageAttributes.OriginType  origin)
          Specifies whether drawing at (0, 0) to pages using these attributes draws at the upper-left corner of the physical page, or at the upper-left corner of the printable area.
 void setPrinterResolution sample code for java.awt.PageAttributes.setPrinterResolution(int) definition code for java.awt.PageAttributes.setPrinterResolution(int) (int printerResolution)
          Specifies the desired cross feed and feed print resolutions in dots per inch for pages using these attributes.
 void setPrinterResolution sample code for java.awt.PageAttributes.setPrinterResolution(int[]) definition code for java.awt.PageAttributes.setPrinterResolution(int[]) (int[] printerResolution)
          Specifies the desired print resolution for pages using these attributes.
 void setPrinterResolutionToDefault sample code for java.awt.PageAttributes.setPrinterResolutionToDefault() definition code for java.awt.PageAttributes.setPrinterResolutionToDefault() ()
          Sets the printer resolution for pages using these attributes to the default.
 void setPrintQuality sample code for java.awt.PageAttributes.setPrintQuality(int) definition code for java.awt.PageAttributes.setPrintQuality(int) (int printQuality)
          Specifies the print quality for pages using these attributes.
 void setPrintQuality sample code for java.awt.PageAttributes.setPrintQuality(java.awt.PageAttributes.PrintQualityType) definition code for java.awt.PageAttributes.setPrintQuality(java.awt.PageAttributes.PrintQualityType) (PageAttributes.PrintQualityType sample code for java.awt.PageAttributes.PrintQualityType definition code for java.awt.PageAttributes.PrintQualityType  printQuality)
          Specifies the print quality for pages using these attributes.
 void setPrintQualityToDefault sample code for java.awt.PageAttributes.setPrintQualityToDefault() definition code for java.awt.PageAttributes.setPrintQualityToDefault() ()
          Sets the print quality for pages using these attributes to the default.
 String sample code for java.lang.String definition code for java.lang.String toString sample code for java.awt.PageAttributes.toString() definition code for java.awt.PageAttributes.toString() ()
          Returns a string representation of this PageAttributes.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

PageAttributes sample code for java.awt.PageAttributes() definition code for java.awt.PageAttributes()

public PageAttributes()
Constructs a PageAttributes instance with default values for every attribute.


PageAttributes sample code for java.awt.PageAttributes(java.awt.PageAttributes) definition code for java.awt.PageAttributes(java.awt.PageAttributes)

public PageAttributes(PageAttributes sample code for java.awt.PageAttributes definition code for java.awt.PageAttributes  obj)
Constructs a PageAttributes instance which is a copy of the supplied PageAttributes.

Parameters:
obj - the PageAttributes to copy.

PageAttributes sample code for java.awt.PageAttributes(java.awt.PageAttributes.ColorType, java.awt.PageAttributes.MediaType, java.awt.PageAttributes.OrientationRequestedType, java.awt.PageAttributes.OriginType, java.awt.PageAttributes.PrintQualityType, int[]) definition code for java.awt.PageAttributes(java.awt.PageAttributes.ColorType, java.awt.PageAttributes.MediaType, java.awt.PageAttributes.OrientationRequestedType, java.awt.PageAttributes.OriginType, java.awt.PageAttributes.PrintQualityType, int[])

public PageAttributes(PageAttributes.ColorType sample code for java.awt.PageAttributes.ColorType definition code for java.awt.PageAttributes.ColorType  color,
                      PageAttributes.MediaType sample code for java.awt.PageAttributes.MediaType definition code for java.awt.PageAttributes.MediaType  media,
                      PageAttributes.OrientationRequestedType sample code for java.awt.PageAttributes.OrientationRequestedType definition code for java.awt.PageAttributes.OrientationRequestedType  orientationRequested,
                      PageAttributes.OriginType sample code for java.awt.PageAttributes.OriginType definition code for java.awt.PageAttributes.OriginType  origin,
                      PageAttributes.PrintQualityType sample code for java.awt.PageAttributes.PrintQualityType definition code for java.awt.PageAttributes.PrintQualityType  printQuality,
                      int[] printerResolution)
Constructs a PageAttributes instance with the specified values for every attribute.

Parameters:
color - ColorType.COLOR or ColorType.MONOCHROME.
media - one of the constant fields of the MediaType class.
orientationRequested - OrientationRequestedType.PORTRAIT or OrientationRequestedType.LANDSCAPE.
origin - OriginType.PHYSICAL or OriginType.PRINTABLE
printQuality - PrintQualityType.DRAFT, PrintQualityType.NORMAL, or PrintQualityType.HIGH
printerResolution - an integer array of 3 elements. The first element must be greater than 0. The second element must be must be greater than 0. The third element must be either 3 or 4.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if one or more of the above conditions is violated.
Method Detail

clone sample code for java.awt.PageAttributes.clone() definition code for java.awt.PageAttributes.clone()

public Object sample code for java.lang.Object definition code for java.lang.Object  clone()
Creates and returns a copy of this PageAttributes.

Overrides:
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
the newly created copy. It is safe to cast this Object into a PageAttributes.
See Also:
Cloneable sample code for java.lang.Cloneable definition code for java.lang.Cloneable

set sample code for java.awt.PageAttributes.set(java.awt.PageAttributes) definition code for java.awt.PageAttributes.set(java.awt.PageAttributes)

public void set(PageAttributes sample code for java.awt.PageAttributes definition code for java.awt.PageAttributes  obj)
Sets all of the attributes of this PageAttributes to the same values as the attributes of obj.

Parameters:
obj - the PageAttributes to copy.

getColor sample code for java.awt.PageAttributes.getColor() definition code for java.awt.PageAttributes.getColor()

public PageAttributes.ColorType sample code for java.awt.PageAttributes.ColorType definition code for java.awt.PageAttributes.ColorType  getColor()
Returns whether pages using these attributes will be rendered in color or monochrome. This attribute is updated to the value chosen by the user.

Returns:
ColorType.COLOR or ColorType.MONOCHROME.

setColor sample code for java.awt.PageAttributes.setColor(java.awt.PageAttributes.ColorType) definition code for java.awt.PageAttributes.setColor(java.awt.PageAttributes.ColorType)

public void setColor(PageAttributes.ColorType sample code for java.awt.PageAttributes.ColorType definition code for java.awt.PageAttributes.ColorType  color)
Specifies whether pages using these attributes will be rendered in color or monochrome. Not specifying this attribute is equivalent to specifying ColorType.MONOCHROME.

Parameters:
color - ColorType.COLOR or ColorType.MONOCHROME.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if color is null.

getMedia sample code for java.awt.PageAttributes.getMedia() definition code for java.awt.PageAttributes.getMedia()

public PageAttributes.MediaType sample code for java.awt.PageAttributes.MediaType definition code for java.awt.PageAttributes.MediaType  getMedia()
Returns the paper size for pages using these attributes. This attribute is updated to the value chosen by the user.

Returns:
one of the constant fields of the MediaType class.

setMedia sample code for java.awt.PageAttributes.setMedia(java.awt.PageAttributes.MediaType) definition code for java.awt.PageAttributes.setMedia(java.awt.PageAttributes.MediaType)

public void setMedia(PageAttributes.MediaType sample code for java.awt.PageAttributes.MediaType definition code for java.awt.PageAttributes.MediaType  media)
Specifies the desired paper size for pages using these attributes. The actual paper size will be determined by the limitations of the target printer. If an exact match cannot be found, an implementation will choose the closest possible match. Not specifying this attribute is equivalent to specifying the default size for the default locale. The default size for locales in the United States and Canada is MediaType.NA_LETTER. The default size for all other locales is MediaType.ISO_A4.

Parameters:
media - one of the constant fields of the MediaType class.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if media is null.

setMediaToDefault sample code for java.awt.PageAttributes.setMediaToDefault() definition code for java.awt.PageAttributes.setMediaToDefault()

public void setMediaToDefault()
Sets the paper size for pages using these attributes to the default size for the default locale. The default size for locales in the United States and Canada is MediaType.NA_LETTER. The default size for all other locales is MediaType.ISO_A4.


getOrientationRequested sample code for java.awt.PageAttributes.getOrientationRequested() definition code for java.awt.PageAttributes.getOrientationRequested()

public PageAttributes.OrientationRequestedType sample code for java.awt.PageAttributes.OrientationRequestedType definition code for java.awt.PageAttributes.OrientationRequestedType  getOrientationRequested()
Returns the print orientation for pages using these attributes. This attribute is updated to the value chosen by the user.

Returns:
OrientationRequestedType.PORTRAIT or OrientationRequestedType.LANDSCAPE.

setOrientationRequested sample code for java.awt.PageAttributes.setOrientationRequested(java.awt.PageAttributes.OrientationRequestedType) definition code for java.awt.PageAttributes.setOrientationRequested(java.awt.PageAttributes.OrientationRequestedType)

public void setOrientationRequested(PageAttributes.OrientationRequestedType sample code for java.awt.PageAttributes.OrientationRequestedType definition code for java.awt.PageAttributes.OrientationRequestedType  orientationRequested)
Specifies the print orientation for pages using these attributes. Not specifying the property is equivalent to specifying OrientationRequestedType.PORTRAIT.

Parameters:
orientationRequested - OrientationRequestedType.PORTRAIT or OrientationRequestedType.LANDSCAPE.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if orientationRequested is null.

setOrientationRequested sample code for java.awt.PageAttributes.setOrientationRequested(int) definition code for java.awt.PageAttributes.setOrientationRequested(int)

public void setOrientationRequested(int orientationRequested)
Specifies the print orientation for pages using these attributes. Specifying 3 denotes portrait. Specifying 4 denotes landscape. Specifying any other value will generate an IllegalArgumentException. Not specifying the property is equivalent to calling setOrientationRequested(OrientationRequestedType.PORTRAIT).

Parameters:
orientationRequested - 3 or 4
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if orientationRequested is not 3 or 4

setOrientationRequestedToDefault sample code for java.awt.PageAttributes.setOrientationRequestedToDefault() definition code for java.awt.PageAttributes.setOrientationRequestedToDefault()

public void setOrientationRequestedToDefault()
Sets the print orientation for pages using these attributes to the default. The default orientation is portrait.


getOrigin sample code for java.awt.PageAttributes.getOrigin() definition code for java.awt.PageAttributes.getOrigin()

public PageAttributes.OriginType sample code for java.awt.PageAttributes.OriginType definition code for java.awt.PageAttributes.OriginType  getOrigin()
Returns whether drawing at (0, 0) to pages using these attributes draws at the upper-left corner of the physical page, or at the upper-left corner of the printable area. (Note that these locations could be equivalent.) This attribute cannot be modified by, and is not subject to any limitations of, the implementation or the target printer.

Returns:
OriginType.PHYSICAL or OriginType.PRINTABLE

setOrigin sample code for java.awt.PageAttributes.setOrigin(java.awt.PageAttributes.OriginType) definition code for java.awt.PageAttributes.setOrigin(java.awt.PageAttributes.OriginType)

public void setOrigin(PageAttributes.OriginType sample code for java.awt.PageAttributes.OriginType definition code for java.awt.PageAttributes.OriginType  origin)
Specifies whether drawing at (0, 0) to pages using these attributes draws at the upper-left corner of the physical page, or at the upper-left corner of the printable area. (Note that these locations could be equivalent.) Not specifying the property is equivalent to specifying OriginType.PHYSICAL.

Parameters:
origin - OriginType.PHYSICAL or OriginType.PRINTABLE
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if origin is null.

getPrintQuality sample code for java.awt.PageAttributes.getPrintQuality() definition code for java.awt.PageAttributes.getPrintQuality()

public PageAttributes.PrintQualityType sample code for java.awt.PageAttributes.PrintQualityType definition code for java.awt.PageAttributes.PrintQualityType  getPrintQuality()
Returns the print quality for pages using these attributes. This attribute is updated to the value chosen by the user.

Returns:
PrintQualityType.DRAFT, PrintQualityType.NORMAL, or PrintQualityType.HIGH

setPrintQuality sample code for java.awt.PageAttributes.setPrintQuality(java.awt.PageAttributes.PrintQualityType) definition code for java.awt.PageAttributes.setPrintQuality(java.awt.PageAttributes.PrintQualityType)

public void setPrintQuality(PageAttributes.PrintQualityType sample code for java.awt.PageAttributes.PrintQualityType definition code for java.awt.PageAttributes.PrintQualityType  printQuality)
Specifies the print quality for pages using these attributes. Not specifying the property is equivalent to specifying PrintQualityType.NORMAL.

Parameters:
printQuality - PrintQualityType.DRAFT, PrintQualityType.NORMAL, or PrintQualityType.HIGH
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if printQuality is null.

setPrintQuality sample code for java.awt.PageAttributes.setPrintQuality(int) definition code for java.awt.PageAttributes.setPrintQuality(int)

public void setPrintQuality(int printQuality)
Specifies the print quality for pages using these attributes. Specifying 3 denotes draft. Specifying 4 denotes normal. Specifying 5 denotes high. Specifying any other value will generate an IllegalArgumentException. Not specifying the property is equivalent to calling setPrintQuality(PrintQualityType.NORMAL).

Parameters:
printQuality - 3, 4, or 5
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if printQuality is not 3 , 4, or 5

setPrintQualityToDefault sample code for java.awt.PageAttributes.setPrintQualityToDefault() definition code for java.awt.PageAttributes.setPrintQualityToDefault()

public void setPrintQualityToDefault()
Sets the print quality for pages using these attributes to the default. The default print quality is normal.


getPrinterResolution sample code for java.awt.PageAttributes.getPrinterResolution() definition code for java.awt.PageAttributes.getPrinterResolution()

public int[] getPrinterResolution()
Returns the print resolution for pages using these attributes. Index 0 of the array specifies the cross feed direction resolution (typically the horizontal resolution). Index 1 of the array specifies the feed direction resolution (typically the vertical resolution). Index 2 of the array specifies whether the resolutions are in dots per inch or dots per centimeter. 3 denotes dots per inch. 4 denotes dots per centimeter.

Returns:
an integer array of 3 elements. The first element must be greater than 0. The second element must be must be greater than 0. The third element must be either 3 or 4.

setPrinterResolution sample code for java.awt.PageAttributes.setPrinterResolution(int[]) definition code for java.awt.PageAttributes.setPrinterResolution(int[])

public void setPrinterResolution(int[] printerResolution)
Specifies the desired print resolution for pages using these attributes. The actual resolution will be determined by the limitations of the implementation and the target printer. Index 0 of the array specifies the cross feed direction resolution (typically the horizontal resolution). Index 1 of the array specifies the feed direction resolution (typically the vertical resolution). Index 2 of the array specifies whether the resolutions are in dots per inch or dots per centimeter. 3 denotes dots per inch. 4 denotes dots per centimeter. Note that the 1.1 printing implementation (Toolkit.getPrintJob) requires that the feed and cross feed resolutions be the same. Not specifying the property is equivalent to calling setPrinterResolution(72).

Parameters:
printerResolution - an integer array of 3 elements. The first element must be greater than 0. The second element must be must be greater than 0. The third element must be either 3 or 4.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if one or more of the above conditions is violated.

setPrinterResolution sample code for java.awt.PageAttributes.setPrinterResolution(int) definition code for java.awt.PageAttributes.setPrinterResolution(int)

public void setPrinterResolution(int printerResolution)
Specifies the desired cross feed and feed print resolutions in dots per inch for pages using these attributes. The same value is used for both resolutions. The actual resolutions will be determined by the limitations of the implementation and the target printer. Not specifying the property is equivalent to specifying 72.

Parameters:
printerResolution - an integer greater than 0.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if printerResolution is less than or equal to 0.

setPrinterResolutionToDefault sample code for java.awt.PageAttributes.setPrinterResolutionToDefault() definition code for java.awt.PageAttributes.setPrinterResolutionToDefault()

public void setPrinterResolutionToDefault()
Sets the printer resolution for pages using these attributes to the default. The default is 72 dpi for both the feed and cross feed resolutions.


equals sample code for java.awt.PageAttributes.equals(java.lang.Object) definition code for java.awt.PageAttributes.equals(java.lang.Object)

public boolean equals(Object sample code for java.lang.Object definition code for java.lang.Object  obj)
Determines whether two PageAttributes are equal to each other.

Two PageAttributes are equal if and only if each of their attributes are equal. Attributes of enumeration type are equal if and only if the fields refer to the same unique enumeration object. This means that an aliased media is equal to its underlying unique media. Printer resolutions are equal if and only if the feed resolution, cross feed resolution, and units are equal.

Overrides:
equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) in class Object sample code for java.lang.Object definition code for java.lang.Object
Parameters:
obj - the object whose equality will be checked.
Returns:
whether obj is equal to this PageAttribute according to the above criteria.
See Also:
Object.hashCode() sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , Hashtable sample code for java.util.Hashtable definition code for java.util.Hashtable

hashCode sample code for java.awt.PageAttributes.hashCode() definition code for java.awt.PageAttributes.hashCode()

public int hashCode()
Returns a hash code value for this PageAttributes.

Overrides:
hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
the hash code.
See Also:
Object.equals(java.lang.Object) sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , Hashtable sample code for java.util.Hashtable definition code for java.util.Hashtable

toString sample code for java.awt.PageAttributes.toString() definition code for java.awt.PageAttributes.toString()

public String sample code for java.lang.String definition code for java.lang.String  toString()
Returns a string representation of this PageAttributes.

Overrides:
toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
the string representation.