Java Doc for PageAttributes.java in  » 6.0-JDK-Core » AWT » java » awt » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » AWT » java.awt 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.awt.PageAttributes

PageAttributes
final public class PageAttributes implements Cloneable(Code)
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.
version:
   1.15, 05/05/07
author:
   David Mendenhall
since:
   1.3


Inner Class :final public static class ColorType extends AttributeValue
Inner Class :final public static class MediaType extends AttributeValue
Inner Class :final public static class OrientationRequestedType extends AttributeValue
Inner Class :final public static class OriginType extends AttributeValue
Inner Class :final public static class PrintQualityType extends AttributeValue


Constructor Summary
public  PageAttributes()
     Constructs a PageAttributes instance with default values for every attribute.
public  PageAttributes(PageAttributes obj)
     Constructs a PageAttributes instance which is a copy of the supplied PageAttributes.
public  PageAttributes(ColorType color, MediaType media, OrientationRequestedType orientationRequested, OriginType origin, PrintQualityType printQuality, int[] printerResolution)
     Constructs a PageAttributes instance with the specified values for every attribute.
Parameters:
  color - ColorType.COLOR or ColorType.MONOCHROME.
Parameters:
  media - one of the constant fields of the MediaType class.
Parameters:
  orientationRequested - OrientationRequestedType.PORTRAIT orOrientationRequestedType.LANDSCAPE.
Parameters:
  origin - OriginType.PHYSICAL or OriginType.PRINTABLE
Parameters:
  printQuality - PrintQualityType.DRAFT, PrintQualityType.NORMAL,or PrintQualityType.HIGH
Parameters:
  printerResolution - an integer array of 3 elements.

Method Summary
public  Objectclone()
     Creates and returns a copy of this PageAttributes. the newly created copy.
public  booleanequals(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.

public  ColorTypegetColor()
     Returns whether pages using these attributes will be rendered in color or monochrome.
public  MediaTypegetMedia()
     Returns the paper size for pages using these attributes.
public  OrientationRequestedTypegetOrientationRequested()
     Returns the print orientation for pages using these attributes.
public  OriginTypegetOrigin()
     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.
public  PrintQualityTypegetPrintQuality()
     Returns the print quality for pages using these attributes.
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).
public  inthashCode()
     Returns a hash code value for this PageAttributes.
public  voidset(PageAttributes obj)
     Sets all of the attributes of this PageAttributes to the same values as the attributes of obj.
public  voidsetColor(ColorType color)
     Specifies whether pages using these attributes will be rendered in color or monochrome.
public  voidsetMedia(MediaType media)
     Specifies the desired paper size for pages using these attributes.
public  voidsetMediaToDefault()
     Sets the paper size for pages using these attributes to the default size for the default locale.
public  voidsetOrientationRequested(OrientationRequestedType orientationRequested)
     Specifies the print orientation for pages using these attributes.
public  voidsetOrientationRequested(int orientationRequested)
     Specifies the print orientation for pages using these attributes. Specifying 3 denotes portrait.
public  voidsetOrientationRequestedToDefault()
     Sets the print orientation for pages using these attributes to the default.
public  voidsetOrigin(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.
public  voidsetPrintQuality(PrintQualityType printQuality)
     Specifies the print quality for pages using these attributes.
public  voidsetPrintQuality(int printQuality)
     Specifies the print quality for pages using these attributes. Specifying 3 denotes draft.
public  voidsetPrintQualityToDefault()
     Sets the print quality for pages using these attributes to the default.
public  voidsetPrinterResolution(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.
public  voidsetPrinterResolution(int printerResolution)
     Specifies the desired cross feed and feed print resolutions in dots per inch for pages using these attributes.
public  voidsetPrinterResolutionToDefault()
     Sets the printer resolution for pages using these attributes to the default.
public  StringtoString()
     Returns a string representation of this PageAttributes.


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



PageAttributes
public PageAttributes(PageAttributes obj)(Code)
Constructs a PageAttributes instance which is a copy of the supplied PageAttributes.
Parameters:
  obj - the PageAttributes to copy.



PageAttributes
public PageAttributes(ColorType color, MediaType media, OrientationRequestedType orientationRequested, OriginType origin, PrintQualityType printQuality, int[] printerResolution)(Code)
Constructs a PageAttributes instance with the specified values for every attribute.
Parameters:
  color - ColorType.COLOR or ColorType.MONOCHROME.
Parameters:
  media - one of the constant fields of the MediaType class.
Parameters:
  orientationRequested - OrientationRequestedType.PORTRAIT orOrientationRequestedType.LANDSCAPE.
Parameters:
  origin - OriginType.PHYSICAL or OriginType.PRINTABLE
Parameters:
  printQuality - PrintQualityType.DRAFT, PrintQualityType.NORMAL,or PrintQualityType.HIGH
Parameters:
  printerResolution - an integer array of 3 elements. The firstelement must be greater than 0. The second element must bemust be greater than 0. The third element must be either3 or 4.
throws:
  IllegalArgumentException - if one or more of the aboveconditions is violated.




Method Detail
clone
public Object clone()(Code)
Creates and returns a copy of this PageAttributes. the newly created copy. It is safe to cast this Object intoa PageAttributes.



equals
public boolean equals(Object obj)(Code)
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.
Parameters:
  obj - the object whose equality will be checked. whether obj is equal to this PageAttribute according to theabove criteria.




getColor
public ColorType getColor()(Code)
Returns whether pages using these attributes will be rendered in color or monochrome. This attribute is updated to the value chosen by the user. ColorType.COLOR or ColorType.MONOCHROME.



getMedia
public MediaType getMedia()(Code)
Returns the paper size for pages using these attributes. This attribute is updated to the value chosen by the user. one of the constant fields of the MediaType class.



getOrientationRequested
public OrientationRequestedType getOrientationRequested()(Code)
Returns the print orientation for pages using these attributes. This attribute is updated to the value chosen by the user. OrientationRequestedType.PORTRAIT orOrientationRequestedType.LANDSCAPE.



getOrigin
public OriginType getOrigin()(Code)
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. OriginType.PHYSICAL or OriginType.PRINTABLE



getPrintQuality
public PrintQualityType getPrintQuality()(Code)
Returns the print quality for pages using these attributes. This attribute is updated to the value chosen by the user. PrintQualityType.DRAFT, PrintQualityType.NORMAL, orPrintQualityType.HIGH



getPrinterResolution
public int[] getPrinterResolution()(Code)
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. an integer array of 3 elements. The firstelement must be greater than 0. The second element must bemust be greater than 0. The third element must be either3 or 4.



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



set
public void set(PageAttributes obj)(Code)
Sets all of the attributes of this PageAttributes to the same values as the attributes of obj.
Parameters:
  obj - the PageAttributes to copy.



setColor
public void setColor(ColorType color)(Code)
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 - if color is null.



setMedia
public void setMedia(MediaType media)(Code)
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 - if media is null.



setMediaToDefault
public void setMediaToDefault()(Code)
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.



setOrientationRequested
public void setOrientationRequested(OrientationRequestedType orientationRequested)(Code)
Specifies the print orientation for pages using these attributes. Not specifying the property is equivalent to specifying OrientationRequestedType.PORTRAIT.
Parameters:
  orientationRequested - OrientationRequestedType.PORTRAIT orOrientationRequestedType.LANDSCAPE.
throws:
  IllegalArgumentException - if orientationRequested is null.



setOrientationRequested
public void setOrientationRequested(int orientationRequested)(Code)
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 - if orientationRequested is not3 or 4



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



setOrigin
public void setOrigin(OriginType origin)(Code)
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 - if origin is null.



setPrintQuality
public void setPrintQuality(PrintQualityType printQuality)(Code)
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 - if printQuality is null.



setPrintQuality
public void setPrintQuality(int printQuality)(Code)
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 - if printQuality is not 3, 4, or 5



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



setPrinterResolution
public void setPrinterResolution(int[] printerResolution)(Code)
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 firstelement must be greater than 0. The second element must bemust be greater than 0. The third element must be either3 or 4.
throws:
  IllegalArgumentException - if one or more of the aboveconditions is violated.



setPrinterResolution
public void setPrinterResolution(int printerResolution)(Code)
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 - if printerResolution is less than orequal to 0.



setPrinterResolutionToDefault
public void setPrinterResolutionToDefault()(Code)
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.



toString
public String toString()(Code)
Returns a string representation of this PageAttributes. the string representation.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.