This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


java.awt.print
class Book

java.lang.Object extended by java.awt.print.Book
All Implemented Interfaces:
Pageable

Most common way to construct:

Book book = new Book();

Based on 85 examples


public class Book
extends Object
implements Pageable

The Book class provides a representation of a document in which pages may have different page formats and page painters. This class uses the {@link Pageable} interface to interact with a {@link PrinterJob}.


Constructor Summary

          Creates a new, empty Book.
 
Method Summary
 void
append(Printable painter, PageFormat page)

          Appends a single page to the end of this Book.
 void
append(Printable painter, PageFormat page, int numPages)

          Appends numPages pages to the end of this Book.
 int

          Returns the number of pages in this Book.
 PageFormat
getPageFormat(int pageIndex)

          Returns the java.awt.print.PageFormat of the page specified by pageIndex.
 Printable
getPrintable(int pageIndex)

          Returns the java.awt.print.Printable instance responsible for rendering the page specified by pageIndex.
 void
setPage(int pageIndex, Printable painter, PageFormat page)

          Sets the PageFormat and the Painter for a specified page number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Book

public Book()
Creates a new, empty Book.

Method Detail

append

public void append(Printable painter,
                   PageFormat page)
Appends a single page to the end of this Book.

Parameters:
painter - the Printable instance that renders the page
page - the size and orientation of the page

append

public void append(Printable painter,
                   PageFormat page,
                   int numPages)
Appends numPages pages to the end of this Book. Each of the pages is associated with page.

Parameters:
painter - the Printable instance that renders the page
page - the size and orientation of the page
numPages - the number of pages to be added to the this Book.

getNumberOfPages

public int getNumberOfPages()
Returns the number of pages in this Book.

Returns:
the number of pages this Book contains.

getPageFormat

public PageFormat getPageFormat(int pageIndex)
                         throws IndexOutOfBoundsException
Returns the {@link PageFormat} of the page specified by pageIndex.

Parameters:
pageIndex - the zero based index of the page whose PageFormat is being requested
Returns:
the PageFormat describing the size and orientation of the page.
Throws:
IndexOutOfBoundsException - if the Pageable does not contain the requested page

getPrintable

public Printable getPrintable(int pageIndex)
                       throws IndexOutOfBoundsException
Returns the {@link Printable} instance responsible for rendering the page specified by pageIndex.

Parameters:
pageIndex - the zero based index of the page whose Printable is being requested
Returns:
the Printable that renders the page.
Throws:
IndexOutOfBoundsException - if the Pageable does not contain the requested page

setPage

public void setPage(int pageIndex,
                    Printable painter,
                    PageFormat page)
             throws IndexOutOfBoundsException
Sets the PageFormat and the Painter for a specified page number.

Parameters:
pageIndex - the zero based index of the page whose painter and format is altered
painter - the Printable instance that renders the page
page - the size and orientation of the page
Throws:
IndexOutOfBoundsException - if the specified page is not already in this Book


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.