Most professional programs have a print preview mechanism that lets you look at your pages on the screen so that you won’t waste paper on a printout that you don’t like. The printing classes of the Java platform do not supply a standard “print preview” dialog box, but it is easy to design your own (see Figure 7.37). In this section, we’ll show you how. The
PrintPreviewDialog class in Listing 7.14 is completely generic—you can reuse it to preview any kind of printout.
To construct a
PrintPreviewDialog, you supply either a
Printable or a
Book, together with a