The Java Developers Almanac 1.4


Order this book from Amazon.

   
Home > List of Packages > java.awt.print  [6 examples]

e686. Displaying the Print Dialog

The print dialog allows the user to change the default printer settings such as the default printer, number of copies, range of pages, etc.
    PrinterJob pjob = PrinterJob.getPrinterJob();
    PageFormat pf = pjob.defaultPage();
    pjob.setPrintable(new PrintableClass(), pf);
    try {
        if (pjob.printDialog()) {
            pjob.print();
        }
    } catch (PrinterException e) {
    }

 Related Examples
e681. The Quintessential Printing Program
e682. Getting the Dimensions of a Printed Page
e683. Setting the Orientation of a Printed Page
e684. Printing Pages with Different Formats
e685. Displaying the Page Format Dialog


© 2002 Addison-Wesley.