java.awt.print
Class Book

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.awt.print.Book
All Implemented Interfaces:
Pageable sample code for java.awt.print.Pageable definition code for java.awt.print.Pageable

public class Book
extends Object sample code for java.lang.Object definition code for java.lang.Object
implements Pageable sample code for java.awt.print.Pageable definition code for java.awt.print.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 Pageable sample code for java.awt.print.Pageable definition code for java.awt.print.Pageable interface to interact with a PrinterJob sample code for java.awt.print.PrinterJob definition code for java.awt.print.PrinterJob .

See Also:
Pageable sample code for java.awt.print.Pageable definition code for java.awt.print.Pageable , PrinterJob sample code for java.awt.print.PrinterJob definition code for java.awt.print.PrinterJob

Field Summary
 
Fields inherited from interface java.awt.print.Pageable sample code for java.awt.print.Pageable definition code for java.awt.print.Pageable
UNKNOWN_NUMBER_OF_PAGES sample code for java.awt.print.Pageable.UNKNOWN_NUMBER_OF_PAGES definition code for java.awt.print.Pageable.UNKNOWN_NUMBER_OF_PAGES
 
Constructor Summary
Book sample code for java.awt.print.Book.Book() definition code for java.awt.print.Book.Book() ()
          Creates a new, empty Book.
 
Method Summary
 void append sample code for java.awt.print.Book.append(java.awt.print.Printable, java.awt.print.PageFormat) definition code for java.awt.print.Book.append(java.awt.print.Printable, java.awt.print.PageFormat) (Printable sample code for java.awt.print.Printable definition code for java.awt.print.Printable  painter, PageFormat sample code for java.awt.print.PageFormat definition code for java.awt.print.PageFormat  page)
          Appends a single page to the end of this Book.
 void append sample code for java.awt.print.Book.append(java.awt.print.Printable, java.awt.print.PageFormat, int) definition code for java.awt.print.Book.append(java.awt.print.Printable, java.awt.print.PageFormat, int) (Printable sample code for java.awt.print.Printable definition code for java.awt.print.Printable  painter, PageFormat sample code for java.awt.print.PageFormat definition code for java.awt.print.PageFormat  page, int numPages)
          Appends numPages pages to the end of this Book.
 int getNumberOfPages sample code for java.awt.print.Book.getNumberOfPages() definition code for java.awt.print.Book.getNumberOfPages() ()
          Returns the number of pages in this Book.
 PageFormat sample code for java.awt.print.PageFormat definition code for java.awt.print.PageFormat getPageFormat sample code for java.awt.print.Book.getPageFormat(int) definition code for java.awt.print.Book.getPageFormat(int) (int pageIndex)
          Returns the PageFormat sample code for java.awt.print.PageFormat definition code for java.awt.print.PageFormat of the page specified by pageIndex.
 Printable sample code for java.awt.print.Printable definition code for java.awt.print.Printable getPrintable sample code for java.awt.print.Book.getPrintable(int) definition code for java.awt.print.Book.getPrintable(int) (int pageIndex)
          Returns the Printable sample code for java.awt.print.Printable definition code for java.awt.print.Printable instance responsible for rendering the page specified by pageIndex.
 void setPage sample code for java.awt.print.Book.setPage(int, java.awt.print.Printable, java.awt.print.PageFormat) definition code for java.awt.print.Book.setPage(int, java.awt.print.Printable, java.awt.print.PageFormat) (int pageIndex, Printable sample code for java.awt.print.Printable definition code for java.awt.print.Printable  painter, PageFormat sample code for java.awt.print.PageFormat definition code for java.awt.print.PageFormat  page)
          Sets the PageFormat and the Painter for a specified page number.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

Book sample code for java.awt.print.Book() definition code for java.awt.print.Book()

public Book()
Creates a new, empty Book.

Method Detail

getNumberOfPages sample code for java.awt.print.Book.getNumberOfPages() definition code for java.awt.print.Book.getNumberOfPages()

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

Specified by:
getNumberOfPages sample code for java.awt.print.Pageable.getNumberOfPages() definition code for java.awt.print.Pageable.getNumberOfPages() in interface Pageable sample code for java.awt.print.Pageable definition code for java.awt.print.Pageable
Returns:
the number of pages this Book contains.

getPageFormat sample code for java.awt.print.Book.getPageFormat(int) definition code for java.awt.print.Book.getPageFormat(int)

public PageFormat sample code for java.awt.print.PageFormat definition code for java.awt.print.PageFormat  getPageFormat(int pageIndex)
                         throws IndexOutOfBoundsException sample code for java.lang.IndexOutOfBoundsException definition code for java.lang.IndexOutOfBoundsException 
Returns the PageFormat sample code for java.awt.print.PageFormat definition code for java.awt.print.PageFormat of the page specified by pageIndex.

Specified by:
getPageFormat sample code for java.awt.print.Pageable.getPageFormat(int) definition code for java.awt.print.Pageable.getPageFormat(int) in interface Pageable sample code for java.awt.print.Pageable definition code for java.awt.print.Pageable
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 sample code for java.lang.IndexOutOfBoundsException definition code for java.lang.IndexOutOfBoundsException - if the Pageable does not contain the requested page

getPrintable sample code for java.awt.print.Book.getPrintable(int) definition code for java.awt.print.Book.getPrintable(int)

public Printable sample code for java.awt.print.Printable definition code for java.awt.print.Printable  getPrintable(int pageIndex)
                       throws IndexOutOfBoundsException sample code for java.lang.IndexOutOfBoundsException definition code for java.lang.IndexOutOfBoundsException 
Returns the Printable sample code for java.awt.print.Printable definition code for java.awt.print.Printable instance responsible for rendering the page specified by pageIndex.

Specified by:
getPrintable sample code for java.awt.print.Pageable.getPrintable(int) definition code for java.awt.print.Pageable.getPrintable(int) in interface Pageable sample code for java.awt.print.Pageable definition code for java.awt.print.Pageable
Parameters:
pageIndex - the zero based index of the page whose Printable is being requested
Returns:
the Printable that renders the page.
Throws:
IndexOutOfBoundsException sample code for java.lang.IndexOutOfBoundsException definition code for java.lang.IndexOutOfBoundsException - if the Pageable does not contain the requested page

setPage sample code for java.awt.print.Book.setPage(int, java.awt.print.Printable, java.awt.print.PageFormat) definition code for java.awt.print.Book.setPage(int, java.awt.print.Printable, java.awt.print.PageFormat)

public void setPage(int pageIndex,
                    Printable sample code for java.awt.print.Printable definition code for java.awt.print.Printable  painter,
                    PageFormat sample code for java.awt.print.PageFormat definition code for java.awt.print.PageFormat  page)
             throws IndexOutOfBoundsException sample code for java.lang.IndexOutOfBoundsException definition code for java.lang.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 sample code for java.lang.IndexOutOfBoundsException definition code for java.lang.IndexOutOfBoundsException - if the specified page is not already in this Book
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if the painter or page argument is null

append sample code for java.awt.print.Book.append(java.awt.print.Printable, java.awt.print.PageFormat) definition code for java.awt.print.Book.append(java.awt.print.Printable, java.awt.print.PageFormat)

public void append(Printable sample code for java.awt.print.Printable definition code for java.awt.print.Printable  painter,
                   PageFormat sample code for java.awt.print.PageFormat definition code for java.awt.print.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
Throws:
NullPointerException - If the painter or page argument is null

append sample code for java.awt.print.Book.append(java.awt.print.Printable, java.awt.print.PageFormat, int) definition code for java.awt.print.Book.append(java.awt.print.Printable, java.awt.print.PageFormat, int)

public void append(Printable sample code for java.awt.print.Printable definition code for java.awt.print.Printable  painter,
                   PageFormat sample code for java.awt.print.PageFormat definition code for java.awt.print.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.
Throws:
NullPointerException - If the painter or page argument is null