java.awt.print
Class PrinterJob
java.lang.Object
|
+--java.awt.print.PrinterJob
public abstract class
PrinterJobextends
Object This class controls printing.
Author:- Aaron M. Renn (arenn@urbanophile.com)
PrinterJob
public PrinterJob()
Initializes a new instance of PrinterJob
.
cancel
public void cancel()
Cancels an in progress print job.
defaultPage
public PageFormat defaultPage()
Returns an instance of the default page which will have the default
paper and orientation.
Returns:
- A default instance of
PageFormat
.
defaultPage
public PageFormat defaultPage(java.awt.print.PageFormat page_format)
Clones the specified PageFormat
object then alters the
clone so that it represents the default page format.
Parameters:
Returns:
- A new default page format.
getCopies
public int getCopies()
Returns the number of copies to be printed.
Returns:
- The number of copies to be printed.
getJobName
public String getJobName()
Returns the name of the print job.
Returns:
- The name of the print job.
getPrinterJob
public static PrinterJob getPrinterJob()
Creates a new print job.
Returns:
- A
PrinterJob
object for the newly created print job.
getUserName
public String getUserName()
Returns the printing user name.
Returns:
isCancelled
public boolean isCancelled()
Tests whether or not this job has been cancelled.
pageDialog
public PageFormat pageDialog(java.awt.print.PageFormat page_format)
Displays a dialog box to the user which allows the page format
attributes to be modified.
Parameters:
Returns:
print
public void print()
Prints the pages.
printDialog
public boolean printDialog()
Displays a dialog box to the user which allows the print job
attributes to be modified.
Returns:
false
if the user cancels the dialog box,
true
otherwise.
setCopies
public void setCopies()
Sets the number of copies to be printed.
setJobName
public String setJobName(java.lang.String job_name)
Sets the name of the print job.
Parameters:
setPageable
public void setPageable(java.awt.print.Pageable pageable)
This sets the pages that are to be printed.
Parameters:
setPrintable
public void setPrintable(java.awt.print.Printable printable)
Sets this specified Printable
as the one to use for
rendering the pages on the print device.
Parameters:
setPrintable
public void setPrintable(java.awt.print.Printable printable, java.awt.print.PageFormat page_format)
Sets the Printable
and the page format for the pages
to be printed.
Parameters:
validatePage
public PageFormat validatePage(java.awt.print.PageFormat page)
Makes any alterations to the specified PageFormat
necessary to make it work with the current printer. The alterations
are made to a clone of the input object, which is then returned.
Parameters:
Returns:
- The validated
PageFormat
.