13.1. How Printing Works
The Printing API uses a callback model, which means that the printing system calls your application when it needs something to be drawn. But it's more complicated than that. The following is a typical sequence of events:
The user of your application requests printed output, usually by clicking on a button or choosing a menu item.
Your application displays a print dialog box that is appropriate for the underlying operating system. The Windows print dialog is shown in Figure 13.1. From this dialog, users can choose a printer, change the number of copies that will be printed, and fiddle with other options.
If the user clicks on the OK button in the print dialog, your application can tell the system to begin a printing job.
The system will call back your rendering code at the appropriate time to render your picture on the printer.
Figure 13.1. The print dialog in Windows
13.1.1. The Players
One class and one interface form the crux of the Printing API:
The PrinterJob class controls the printing process. You can use this class to kick off printing or to cancel a job in progress. This class also includes methods for displaying a print dialog and a page setup dialog.
 Don't confuse this with java.awt.PrintJob, which was part of JDK 1.1's printing solution.
The Printable interface represents something that ...