|
Custom Print, Page Setup, and Print Preview Dialogs |
|
J2PrinterWorks supports the two standard print dialogs and two standard page setup dialogs made available by the Java JDK. Java provides for a "native" print dialog and a "native" page setup dialog, which invoke the standard print and page setup dialogs provided by the underlying OS, e.g. Windows, Mac, Unix, etc. Java also provides for a "cross-platform" print dialog and a "cross-platform" page setup dialog, which are Swing-based dialogs that look essentially the same regardless of the underlying OS platform. Unfortunately, Java does not provide source code for any of these dialogs, so that if a developer wishes to add or remove features in any of these dialogs, they are unable to do so.
In addition, Java does not provide any standard print preview dialog, so since its inception J2PrinterWorks has provided a full-featured print preview dialog comparable to the print preview dialogs present in most commercial applications. However, previously we did not make available the source code for this J2PrinterWorks print dialog (except to Source Code Licensees), so that if a developer wished to add or remove features from the J2PrinterWorks print preview dialog, they were likewise unable to do this.
The J2PrinterWorks 5.0 release has expanded its API sufficiently so that it is now possible to write complete print, page setup, and print preview dialogs entirely using J2PrinterWorks. To this end, the J2PrinterWorks 5.0 distribution includes sample programs with complete source code for three print dialogs, two page setup dialogs, and two print preview dialogs (one of which is the standard, full-featured J2PrinterWorks print preview dialog). Any of these may be customized by developers to create print, page setup, and/or print preview dialogs with the features and appearance of their choosing.
Print dialogs
The sample program J2Printer14SimplePrintDialog includes the class SimplePrintDialog and produces a print dialog that looks as follows:
The above print dialog requires the use of the class J2Printer14 and JDK 1.4 or later.The above page setup dialog requires the use of the class J2Printer14 and JDK 1.4 or later.
Print preview dialogs
The sample program J2PrinterWorksFullPrintPreviewDialog includes the class PrintPreviewDialog that is the same code as is used to implement the built-in J2PrinterWorks full-featured print preview dialog, which produces a print preview dialog that looks as follows: