Book class provides a representation of a document in
which pages may have different page formats and page painters. This
class uses the Pageable interface to interact with a
PrinterJob.
Pageable, PrinterJob
| Modifier and Type | Class and Description |
|---|---|
| private static class | Book.
The BookPage inner class describes an individual page in a Book through a PageFormat-Printable pair. |
| Modifier and Type | Field and Description |
|---|---|
| private Vector | mPages
The set of pages that make up the Book. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | append(Printable
the painter, PageFormat Printable instance that
renders the pagethe size and orientation of the page page)Appends a single page to the end of this |
| public void | append(Printable
the painter, PageFormat Printable instance that renders
the pagethe size and orientation of the page page, int the number of pages to be added to the
this numPages)Book.Appends |
| public int | Returns: the number of pages thisBook contains.Implements java. Returns the number of pages in this |
| private Book. | |
| public PageFormat | Returns: thePageFormat describing the size and
orientation of the page.the zero based index of the page whose
pageIndex)PageFormat is being requestedImplements java. Returns the |
| public Printable | Returns: thePrintable that renders the page.the zero based index of the page whose
pageIndex)Printable is being requestedImplements java. Returns the |
| public void | setPage(int
the zero based index of the page whose
painter and format is altered pageIndex, Printable the painter, PageFormat Printable instance that
renders the pagethe size and orientation of the page page)Sets the |
| mPages | back to summary |
|---|---|
| private Vector<Book. The set of pages that make up the Book. | |
| Book | back to summary |
|---|---|
| public Book() Creates a new, empty | |
| append | back to summary |
|---|---|
| public void append(Printable painter, PageFormat page) Appends a single page to the end of this
| |
| append | back to summary |
|---|---|
| public void append(Printable painter, PageFormat page, int numPages) Appends
| |
| getNumberOfPages | back to summary |
|---|---|
| public int getNumberOfPages() Implements java. Returns the number of pages in this
| |
| getPage | back to summary |
|---|---|
| private Book. Return the BookPage for the page specified by 'pageIndex'. | |
| getPageFormat | back to summary |
|---|---|
| public PageFormat getPageFormat(int pageIndex) throws IndexOutOfBoundsException Implements java. Returns the
| |
| getPrintable | back to summary |
|---|---|
| public Printable getPrintable(int pageIndex) throws IndexOutOfBoundsException Implements java. Returns the
| |
| setPage | back to summary |
|---|---|
| public void setPage(int pageIndex, Printable painter, PageFormat page) throws IndexOutOfBoundsException Sets the
| |
| Modifier and Type | Field and Description |
|---|---|
| private PageFormat | mFormat
The size and orientation of the page. |
| private Printable | mPainter
The instance that will draw the page. |
| Access | Constructor and Description |
|---|---|
| pack-priv | BookPage(Printable painter, PageFormat format)
A new instance where 'format' describes the page's size and orientation and 'painter' is the instance that will draw the page's graphics. |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv PageFormat | |
| pack-priv Printable |
| mFormat | back to summary |
|---|---|
| private PageFormat mFormat The size and orientation of the page. | |
| mPainter | back to summary |
|---|---|
| private Printable mPainter The instance that will draw the page. | |
| BookPage | back to summary |
|---|---|
| pack-priv BookPage(Printable painter, PageFormat format) A new instance where 'format' describes the page's size and orientation and 'painter' is the instance that will draw the page's graphics.
| |
| getPageFormat | back to summary |
|---|---|
| pack-priv PageFormat getPageFormat() Return the format of the page. | |
| getPrintable | back to summary |
|---|---|
| pack-priv Printable getPrintable() Return the instance that paints the page. | |