public class Book extends Object implements Pageable
Book类提供了一个文档的表示,其中页面可能具有不同的页面格式和页面绘图。
该类使用Pageable接口与一个互动PrinterJob 。
Pageable , PrinterJob
UNKNOWN_NUMBER_OF_PAGES| Constructor and Description |
|---|
Book()
创建一个新的,空的
Book 。
|
| Modifier and Type | Method and Description |
|---|---|
void |
append(Printable painter, PageFormat page)
在这个
Book的末尾添加一个页面。
|
void |
append(Printable painter, PageFormat page, int numPages)
追加
numPages页本月底
Book 。
|
int |
getNumberOfPages()
返回此
Book中的页数。
|
PageFormat |
getPageFormat(int pageIndex)
返回pageIndex指定页面的 pageIndex 。
|
Printable |
getPrintable(int pageIndex)
返回 Printable实例,负责渲染由pageIndex指定的页面。
|
void |
setPage(int pageIndex, Printable painter, PageFormat page)
为指定的
PageFormat设置
PageFormat和
Painter 。
|
public int getNumberOfPages()
Book中的页数。
getNumberOfPages在界面
Pageable
Book包含的页数。
public PageFormat getPageFormat(int pageIndex) throws IndexOutOfBoundsException
pageIndex 。
getPageFormat在界面
Pageable
pageIndex - 正在请求PageFormat的页面的
PageFormat基索引
PageFormat页面的大小和方向。
IndexOutOfBoundsException - 如果
Pageable不包含请求的页面
public Printable getPrintable(int pageIndex) throws IndexOutOfBoundsException
Printable实例,负责渲染由pageIndex指定的页面。
getPrintable在界面
Pageable
pageIndex - 正在请求Printable的页面的
Printable基索引
Printable呈现页面。
IndexOutOfBoundsException - 如果
Pageable不包含请求的页面
public void setPage(int pageIndex,
Printable painter,
PageFormat page)
throws IndexOutOfBoundsException
PageFormat设置
PageFormat和
Painter 。
pageIndex - 其画家和格式被更改的页面的零
pageIndex引
painter - 呈现页面的
Printable实例
page - 页面的大小和方向
IndexOutOfBoundsException - 如果指定的页面不在此
Book
NullPointerException - 如果
painter或
page参数是
null
public void append(Printable painter, PageFormat page)
Book的末尾添加一个页面。
painter - 呈现页面的
Printable实例
page - 页面的大小和方向
NullPointerException - 如果
painter或
page参数是
null
public void append(Printable painter, PageFormat page, int numPages)
numPages页本月底Book 。
每个页面都与page 。
painter - 呈现页面的
Printable实例
page - 页面的大小和方向
numPages - 要添加到此
Book 。
NullPointerException - 如果
painter或
page参数是
null
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.