|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
This is an interface which must be supported by objects which print to the printer. During the printing process the validatePage(int pageIndex) is called for each page to be printed (starting from 0) and if it returns true, then the print() method will be called for that page index. This process continues until validatePage() returns false.
| Field Summary | |
static int |
UNKNOWN_NUMBER_OF_PAGES
|
| Method Summary | |
int |
countPages(PageFormat page)
This is called when printing is about to start and it requests a count of the number of pages that would be necessary to print. |
boolean |
print(Handle handle,
PrintSurface printSurface,
PageFormat page,
int pageIndex)
Prints the page at the specified index into the specified Graphics context in the specified format. |
boolean |
validatePage(PageFormat page,
int pageIndex)
This returns true if the page with the specified index should be printed. |
| Field Detail |
public static final int UNKNOWN_NUMBER_OF_PAGES
| Method Detail |
public boolean print(Handle handle,
PrintSurface printSurface,
PageFormat page,
int pageIndex)
Within this method you should call printSurface.getPageRect() to get a Rectangular window onto the virtual printer page. You can then draw into the image provided by that PageRect and then afterwards, transfer the PageRect to the printer using printSurface.putPageRect().
The PageMosaic class is an excellent class for allowing you to draw onto an arbitrary section on the output page.
handle - a Handle that an outside thread can use to monitor the printing. During the printing
you should check the shouldStop value of the Handle, and if it is true, then you should abort printing
and return false.printSurface - A printSurface that you should call getPageRect() on in order to get buffers to
draw on.page - the format for the page you are printing on.pageIndex - the index of the page you are printing on, starting from index 0.
public boolean validatePage(PageFormat page,
int pageIndex)
public int countPages(PageFormat page)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||