- java.lang.Object
-
- java.awt.print.Book
-
- All Implemented Interfaces:
-
Pageable
public class Book extends Object implements Pageable
Book类提供了一个文档的表示,其中页面可能具有不同的页面格式和页面绘图。 该类使用Pageable接口与PrinterJob进行交互。- 另请参见:
-
Pageable,PrinterJob
-
-
Field Summary
-
Fields inherited from interface java.awt.print.Pageable
UNKNOWN_NUMBER_OF_PAGES
-
-
构造方法摘要
构造方法 Constructor 描述 Book()创建一个新的,空的Book。
-
方法摘要
所有方法 接口方法 具体的方法 Modifier and Type 方法 描述 voidappend(Printable painter, PageFormat page)追加一页到这个Book。voidappend(Printable painter, PageFormat page, int numPages)追加numPages页到这个Book。intgetNumberOfPages()返回此Book的页数。PageFormatgetPageFormat(int pageIndex)返回由pageIndex指定的页面中的pageIndex。PrintablegetPrintable(int pageIndex)返回负责呈现由pageIndex指定的页面的Printable实例。voidsetPage(int pageIndex, Printable painter, PageFormat page)为指定的页码设置PageFormat和Painter。
-
-
-
方法详细信息
-
getNumberOfPages
public int getNumberOfPages()
返回此Book的页数。- Specified by:
-
getNumberOfPages在接口Pageable - 结果
-
这个
Book包含的页面数。
-
getPageFormat
public PageFormat getPageFormat(int pageIndex) throws IndexOutOfBoundsException
返回pageIndex指定页面的pageIndex。- Specified by:
-
getPageFormat在接口Pageable - 参数
-
pageIndex- 正在请求其PageFormat的页面的零PageFormat - 结果
-
描述页面的大小和方向的
PageFormat。 - 异常
-
IndexOutOfBoundsException- 如果Pageable不包含请求的页面
-
getPrintable
public Printable getPrintable(int pageIndex) throws IndexOutOfBoundsException
返回Printable实例,负责渲染由pageIndex指定的pageIndex。- Specified by:
-
getPrintable在接口Pageable - 参数
-
pageIndex- 正在请求其Printable的页面的零Printable - 结果
-
该页面呈现
Printable。 - 异常
-
IndexOutOfBoundsException- 如果Pageable不包含请求的页面
-
setPage
public void setPage(int pageIndex, Printable painter, PageFormat page) throws IndexOutOfBoundsException为指定的页码设置PageFormat和Painter。- 参数
-
pageIndex- 其画家和格式被更改的页面的零pageIndex引 -
painter- 呈现页面的Printable实例 -
page- 页面的大小和方向 - 异常
-
IndexOutOfBoundsException- 如果指定的页面尚未在此Book -
NullPointerException- 如果painter或page参数是null
-
append
public void append(Printable painter, PageFormat page)
追加一页到这个Book。- 参数
-
painter- 呈现页面的Printable实例 -
page- 页面的大小和方向 - 异常
-
NullPointerException- 如果painter或page参数是null
-
append
public void append(Printable painter, PageFormat page, int numPages)
追加numPages页到这个Book。 每个页面都与page相关联。- 参数
-
painter- 呈现页面的Printable实例 -
page- 页面的大小和方向 -
numPages- 要添加到此Book。 - 异常
-
NullPointerException- 如果painter或page参数是null
-
-