|
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.ComponentPageable
A Pageable
object that breaks an arbitrary Swing component into
pages for previewing and printing. This class uses the component's
size and a specified page format to determine the number of pages.
If the component's width and height are zero, then this class first sizes
the component to its preferred size and validates it. This class has
undefined results if the component's size changes from the time the constructor
is called to the time the pages are rendered.
PageableAdapter
Field Summary |
Fields inherited from interface java.awt.print.Pageable |
UNKNOWN_NUMBER_OF_PAGES |
Constructor Summary | |
ComponentPageable(javax.swing.JComponent component,
java.awt.print.PageFormat pageFormat)
Creates an instance of ComponentPageable
with the specified component and page format. |
Method Summary | |
void |
fit(boolean keepAspectRatio)
Scales the component so that it fits the page. |
void |
fitHeight(boolean keepAspectRatio)
Scales the component so that it fits the page height. |
void |
fitWidth(boolean keepAspectRatio)
Scales the component so that it fits the page width. |
int |
getNumberOfPages()
Returns the number of pages. |
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 ComponentPageable(javax.swing.JComponent component, java.awt.print.PageFormat pageFormat)
ComponentPageable
with the specified component and page format.
component
- component to break into pagespageFormat
- the page format of each page
java.lang.NullPointerException
- if either parameter is null
Method Detail |
public void fit(boolean keepAspectRatio)
Clients should invoke only one of fit
, fitWidth
,
and fitHeight
. Repeated calls cancel previous calls.
keepAspectRatio
- true if the component's ratio of width
to height should be maintainedfitWidth(boolean)
,
fitHeight(boolean)
public void fitHeight(boolean keepAspectRatio)
Clients should invoke only one of fit
, fitWidth
,
and fitHeight
. Repeated calls cancel previous calls.
keepAspectRatio
- true if the component's ratio of width
to height should be maintainedfit(boolean)
,
fitWidth(boolean)
public void fitWidth(boolean keepAspectRatio)
Clients should invoke only one of fit
, fitWidth
,
and fitHeight
. Repeated calls cancel previous calls.
keepAspectRatio
- true if the component's ratio of width
to height should be maintainedfit(boolean)
,
fitHeight(boolean)
public int getNumberOfPages()
getNumberOfPages
in interface java.awt.print.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
java.lang.IndexOutOfBoundsException
- if this Pageable
does not contain
the specified pagepublic 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
Printable
for the specified page
java.lang.IndexOutOfBoundsException
- if this Pageable
does not contain
the specified 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 |