FileDocCategorySizeDatePackage
PageFormatMania.javaAPI DocExample1208Mon Apr 05 11:54:42 BST 1999None

PageFormatMania

public class PageFormatMania extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

    PrinterJob pj = PrinterJob.getPrinterJob();
    
    PageFormat pf = pj.defaultPage();
    Paper paper = new Paper();
    double margin = 36; // half inch
    paper.setImageableArea(margin, margin,
        paper.getWidth() - margin * 2,
        paper.getHeight() - margin * 2);
    pf.setPaper(paper);
    
    pj.setPrintable(new ManiaPrintable(), pf);
    if (pj.printDialog()) {
      try { pj.print(); }
      catch (PrinterException e) {
        System.out.println(e);
      }
    }