|
JavaTM 2 Platform Std. Ed. v1.3.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.print.PrinterJob
The PrinterJob
class is the principal class that controls
printing. An application calls methods in this 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()
A PrinterJob object should be created using the
static method. |
Method Summary | |
abstract void |
cancel()
Cancels a print job that is in progress. |
PageFormat |
defaultPage()
Creates a new PageFormat instance and
sets it to a default size and orientation. |
abstract PageFormat |
defaultPage(PageFormat page)
Clones the PageFormat argument and alters the
clone to describe a default page size and orientation. |
abstract int |
getCopies()
Gets the number of copies to be printed. |
abstract String |
getJobName()
Gets the name of the document to be printed. |
static PrinterJob |
getPrinterJob()
Creates and returns a PrinterJob . |
abstract String |
getUserName()
Gets the name of the printing user. |
abstract boolean |
isCancelled()
Returns true if a print job is
in progress, but is going to be cancelled
at the next opportunity; otherwise returns
false . |
abstract PageFormat |
pageDialog(PageFormat page)
Displays a dialog that allows modification of a PageFormat instance. |
abstract void |
print()
Prints a set of pages. |
abstract boolean |
printDialog()
Presents a dialog to the user for changing the properties of the print job. |
abstract void |
setCopies(int copies)
Sets the number of copies to be printed. |
abstract void |
setJobName(String jobName)
Sets the name of the document to be printed. |
abstract void |
setPageable(Pageable document)
Queries document for the number of pages and
the PageFormat and Printable for each
page held in the Pageable instance,
document . |
abstract void |
setPrintable(Printable painter)
Calls painter to render the pages. |
abstract void |
setPrintable(Printable painter,
PageFormat format)
Calls painter to render the pages in the specified
format . |
abstract PageFormat |
validatePage(PageFormat page)
Returns the clone of page with its settings
adjusted to be compatible with the current printer of this
PrinterJob . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PrinterJob()
PrinterJob
object should be created using the
static getPrinterJob
method.Method Detail |
public static PrinterJob getPrinterJob()
PrinterJob
.PrinterJob
.public abstract void setPrintable(Printable painter)
painter
to render the pages. The pages in the
document to be printed by this
PrinterJob
are rendered by the Printable
object, painter
. The PageFormat
for each page
is the default page format.painter
- the Printable
that renders each page of
the document.public abstract void setPrintable(Printable painter, PageFormat format)
painter
to render the pages in the specified
format
. The pages in the document to be printed by
this PrinterJob
are rendered by the
Printable
object, painter
. The
PageFormat
of each page is format
.painter
- the Printable
called to render
each page of the documentformat
- the size and orientation of each page to
be printedpublic abstract void setPageable(Pageable document) throws NullPointerException
document
for the number of pages and
the PageFormat
and Printable
for each
page held in the Pageable
instance,
document
.document
- the pages to be printed. It can not be
null
.NullPointerException
- the Pageable
passed in
was null
.PageFormat
,
Printable
public abstract boolean printDialog()
true
if the user does not cancel the dialog;
false
otherwise.public abstract PageFormat pageDialog(PageFormat page)
PageFormat
instance.
The page
argument is used to initialize controls
in the page setup dialog.
If the user cancels the dialog then this method returns the
original page
object unmodified.
If the user okays the dialog then this method returns a new
PageFormat
object with the indicated changes.
In either case, the original page
object is
not modified.page
- the default PageFormat
presented to the
user for modificationpage
object if the dialog
is cancelled; a new PageFormat
object
containing the format indicated by the user if the
dialog is acknowledged.public abstract PageFormat defaultPage(PageFormat page)
PageFormat
argument and alters the
clone to describe a default page size and orientation.page
- the PageFormat
to be cloned and alteredpage
, altered to describe a default
PageFormat
.public PageFormat defaultPage()
PageFormat
instance and
sets it to a default size and orientation.PageFormat
set to a default size and
orientation.public abstract PageFormat validatePage(PageFormat page)
page
with its settings
adjusted to be compatible with the current printer of this
PrinterJob
. For example, the returned
PageFormat
could have its imageable area
adjusted to fit within the physical area of the paper that
is used by the current printer.page
- the PageFormat
that is cloned and
whose settings are changed to be compatible with
the current printerPageFormat
that is cloned from
page
and whose settings are changed
to conform with this PrinterJob
.public abstract void print() throws PrinterException
PrinterException
- an error in the print system
caused the job to be aborted.Book
,
Pageable
,
Printable
public abstract void setCopies(int copies)
copies
- the number of copies to be printedpublic abstract int getCopies()
public abstract String getUserName()
public abstract void setJobName(String jobName)
null
.jobName
- the name of the document to be printedpublic abstract String getJobName()
public abstract void cancel()
print
has been called but has not
returned then this method signals
that the job should be cancelled at the next
chance. If there is no print job in progress then
this call does nothing.public abstract boolean isCancelled()
true
if a print job is
in progress, but is going to be cancelled
at the next opportunity; otherwise returns
false
.true
if the job in progress
is going to be cancelled; false
otherwise.
|
JavaTM 2 Platform Std. Ed. v1.3.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Java, Java 2D, and JDBC are trademarks or registered trademarks of Oracle and/or its affiliates, in the US and other countries.
Copyright © 1995, 2010 Oracle and/or its affiliates. All rights reserved.