|
Side of Software Print Preview Library 1.8.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--sos.preview.PageableAdapter
A class that converts a java.awt.print.Printable
object into
a java.awt.print.Pageable
object. All pages use the same
page format.
To treat an existing printable object as a pageable object,
create an instance of PageableAdapter
,
passing the printable object and the desired page format.
An instance of PageableAdapter
can be used anywhere a
Pageable
object is accepted. For instance, it can be
passed to JPrintPreviewPane.setPageable(java.awt.print.Pageable)
.
PageableAdapter
works by creating a one-time image of the
Printable
object at 100%. Therefore, if a PageableAdapter
is used in a JPrintPreviewPane
, the pages will become
more and more pixilated
as the user zooms in. For smooth zooming, use a custom Pageable
object.
ComponentPageable
Field Summary |
Fields inherited from interface java.awt.print.Pageable |
UNKNOWN_NUMBER_OF_PAGES |
Constructor Summary | |
PageableAdapter(java.awt.print.Printable printable,
java.awt.print.PageFormat pageFormat)
Creates an instance of PageableAdapter with the specified
Printable and PageFormat objects. |
Method Summary | |
int |
getNumberOfPages()
Returns the number of pages in the set. |
java.awt.print.PageFormat |
getPageFormat(int pageIndex)
Returns the PageFormat of the page specified by
pageIndex . |
java.awt.print.Printable |
getPrintable(int pageIndex)
Returns the Printable instance responsible for
rendering the page specified by pageIndex . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PageableAdapter(java.awt.print.Printable printable, java.awt.print.PageFormat pageFormat) throws java.awt.print.PrinterException
PageableAdapter
with the specified
Printable
and PageFormat
objects.
printable
- object to be printedpageFormat
- format of each printed page
java.lang.NullPointerException
- if any argument is null
java.awt.print.PrinterException
- if a print exception occursMethod Detail |
public int getNumberOfPages()
Pageable
implementations return the true number of pages
rather than the
UNKNOWN_NUMBER_OF_PAGES constant.
getNumberOfPages
in interface java.awt.print.Pageable
Pageable
.public java.awt.print.PageFormat getPageFormat(int pageIndex) throws java.lang.IndexOutOfBoundsException
PageFormat
of the page specified by
pageIndex
.
getPageFormat
in interface java.awt.print.Pageable
pageIndex
- the zero based index of the page whose
PageFormat
is being requested
PageFormat
describing the size and
orientation.
java.lang.IndexOutOfBoundsException
- if
the Pageable
does not contain the requested
page.public java.awt.print.Printable getPrintable(int pageIndex) throws java.lang.IndexOutOfBoundsException
Printable
instance responsible for
rendering the page specified by pageIndex
.
getPrintable
in interface java.awt.print.Pageable
pageIndex
- the zero based index of the page whose
Printable
is being requested
Printable
that renders the page.
java.lang.IndexOutOfBoundsException
- if
the Pageable
does not contain the requested
page.
|
Side of Software Print Preview Library 1.8.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |