Class | Tree | Deprecated | Index | Help
PREV | NEXT SHOW LISTS | HIDE LISTS

Class java.awt.print.PrinterJob

java.lang.Object
    |
    +----java.awt.print.PrinterJob

public abstract class PrinterJob
extends java.lang.Object
The principal class that controls printing. An application calls methods int his class to set up a job, optionally to invoke a print dialog with the user, and then to print the pages of the job.


Constructor Summary
 PrinterJob()
 
 

Method Summary
void  cancel()
If a print job is in progress, print() has been called but has not returned, then this signals that the job should be cancelled at the next chance.
PageFormat  defaultPage(PageFormat page)
The passed in PageFormat is cloned and the clone altered to describe a default page size and orientation.
PageFormat  defaultPage()
A new PageFormat instance is created and then set with a default size and orientation.
int  getCopies()
Get the number of copies to be printed.
java.lang.String  getJobName()
Get the name of the document to be printed.
static PrinterJob  getPrinterJob()
Creates and returns a PrinterJob.
java.lang.String  getUserName()
Get the name of the printing user.
boolean  isCancelled()
Returns true is a print job is ongoing but will be cancelled and the next opportunity.
PageFormat  pageDialog(PageFormat page)
Display a dialog to the user allowing the modification of a PageFormat instance.
void  print()
Prints a set of pages.
boolean  printDialog()
Presents the user a dialog for changing properties of the print job interactively.
void  setCopies(int copies)
Set the number of copies to be printed.
void  setJobName(java.lang.String jobName)
Set the name of the document to be printed.
void  setPageable(Pageable document)
The pages in the document to be printed are held by the Pageable instance 'document'.
void  setPrintable(Printable painter)
The pages in the document to be printed by this PrinterJob are drawn by the Printable object 'painter'.
void  setPrintable(Printable painter, PageFormat format)
The pages in the document to be printed by this PrinterJob are drawn by the Printable object 'painter'.
PageFormat  validatePage(PageFormat page)
The passed in PageFormat is altered to be usable on the PrinterJob's current printer.
 
Methods inherited from class java.lang.Object
 equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrinterJob

public PrinterJob()
Method Detail

getPrinterJob

public static PrinterJob getPrinterJob()
Creates and returns a PrinterJob.

setPrintable

public abstract void setPrintable(Printable painter)
The pages in the document to be printed by this PrinterJob are drawn by the Printable object 'painter'. The PageFormat for each page is the default page format.
Parameters:
Printable - Called to render each page of the document.

setPrintable

public abstract void setPrintable(Printable painter,
                                  PageFormat format)
The pages in the document to be printed by this PrinterJob are drawn by the Printable object 'painter'. The PageFormat of each page is 'format'.
Parameters:
Printable - Called to render each page of the document.
PageFormat - The size and orientation of each page to be printed.

setPageable

public abstract void setPageable(Pageable document) throws java.lang.NullPointerException
The pages in the document to be printed are held by the Pageable instance 'document'. 'document' will be queried for the number of pages as well as the PageFormat and Printable for each page.
Parameters:
Pageable - The document to be printed. It may not be null.
Throws:
java.lang.NullPointerException - the Pageable passed in was null.
See Also:
PageFormat, Printable

printDialog

public abstract boolean printDialog()
Presents the user a dialog for changing properties of the print job interactively.

pageDialog

public abstract PageFormat pageDialog(PageFormat page)
Display a dialog to the user allowing the modification of a PageFormat instance. The page argument is used to initialize controls in the page setup dialog. If the user cancels the dialog, then the method returns the original page object unmodified. If the user okays the dialog then the method returns a new PageFormat object with the indicated changes. In either case the original page object will not be modified.
Parameters:
page - the default PageFormat presented to the user for modification
Returns:
the original page object if the dialog is cancelled, or a new PageFormat object containing the format indicated by the user if the dialog is acknowledged

defaultPage

public abstract PageFormat defaultPage(PageFormat page)
The passed in PageFormat is cloned and the clone altered to describe a default page size and orientation.
Parameters:
PageFormat - This object is cloned and the clone altered to describe a default PageFormat.

defaultPage

public PageFormat defaultPage()
A new PageFormat instance is created and then set with a default size and orientation.

validatePage

public abstract PageFormat validatePage(PageFormat page)
The passed in PageFormat is altered to be usable on the PrinterJob's current printer.
Parameters:
java.awt.print.PageFormat - this page description is cloned and then its settings are altered to be usuable for this printer job.
Returns:
java.awt.print.PageFormat a page description clones from the PageFormat parameter and altered to conform with this PrinterJob.

print

public abstract void print() throws PrinterException
Prints a set of pages.
Throws:
PrinterException - an error in the print system caused the job to be aborted
See Also:
Book, Pageable, Printable

setCopies

public abstract void setCopies(int copies)
Set the number of copies to be printed.

getCopies

public abstract int getCopies()
Get the number of copies to be printed.

getUserName

public abstract java.lang.String getUserName()
Get the name of the printing user.

setJobName

public abstract void setJobName(java.lang.String jobName)
Set the name of the document to be printed. The document name can not be null.

getJobName

public abstract java.lang.String getJobName()
Get the name of the document to be printed.

cancel

public abstract void cancel()
If a print job is in progress, print() has been called but has not returned, then this signals that the job should be cancelled and the next chance. If there is no print job in progress then this call does nothing.

isCancelled

public abstract boolean isCancelled()
Returns true is a print job is ongoing but will be cancelled at the next opportunity. false is returned otherwise.

Class | Tree | Deprecated | Index | Help
PREV | NEXT SHOW LISTS | HIDE LISTS