Documentation of 'org.jhotdraw.draw.print.DrawingPageable' Java class
DrawingPageable
org.jhotdraw.draw.print

Class DrawingPageable

  • All Implemented Interfaces:
    java.awt.print.Pageable


    public class DrawingPageable
    extends java.lang.Object
    implements java.awt.print.Pageable
    DrawingPageable can be used to print a Drawing using the java.awt.print API.

    Usage:

     Pageable pageable = new DrawingPageable(aDrawing);
     PrinterJob job = PrinterJob.getPrinterJob();
     job.setPageable(pageable);
     if (job.printDialog()) {
         try {
             job.print();
          } catch (PrinterException e) {
              ...inform the user that we couldn't print...
          }
     }
     
    See Also:
    PrintFileAction
    • Field Summary

      • Fields inherited from interface java.awt.print.Pageable

        UNKNOWN_NUMBER_OF_PAGES
    • Constructor Summary

      Constructors 
      Constructor and Description
      DrawingPageable(Drawing drawing)
      Creates a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      int getNumberOfPages() 
      java.awt.print.PageFormat getPageFormat(int pageIndex) 
      java.awt.print.Printable getPrintable(int pageIndex) 
      int printPage(java.awt.Graphics graphics, java.awt.print.PageFormat pageFormat, int pageIndex) 
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DrawingPageable

        public DrawingPageable(Drawing drawing)
        Creates a new instance.
    • Method Detail

      • getNumberOfPages

        public int getNumberOfPages()
        Specified by:
        getNumberOfPages in interface java.awt.print.Pageable
      • getPageFormat

        public java.awt.print.PageFormat getPageFormat(int pageIndex)
                                                throws java.lang.IndexOutOfBoundsException
        Specified by:
        getPageFormat in interface java.awt.print.Pageable
        Throws:
        java.lang.IndexOutOfBoundsException
      • getPrintable

        public java.awt.print.Printable getPrintable(int pageIndex)
                                              throws java.lang.IndexOutOfBoundsException
        Specified by:
        getPrintable in interface java.awt.print.Pageable
        Throws:
        java.lang.IndexOutOfBoundsException
      • printPage

        public int printPage(java.awt.Graphics graphics,
                             java.awt.print.PageFormat pageFormat,
                             int pageIndex)
                      throws java.awt.print.PrinterException
        Throws:
        java.awt.print.PrinterException

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.