home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 25 / CDROM25.iso / Share / prog / VJ11 / VJTRIAL.EXE / IE30Java.exe / classd.exe / sun / awt / win32 / Win32PrintJob.java < prev   
Encoding:
Java Source  |  1997-01-27  |  2.3 KB  |  89 lines

  1. /*
  2.  * @(#)Win32PrintJob.java    1.3 96/03/29 Erik Gilbert
  3.  *
  4.  * Copyright (c) 1996 Sun Microsystems, Inc. All Rights Reserved.
  5.  *
  6.  * Permission to use, copy, modify, and distribute this software
  7.  * and its documentation for NON-COMMERCIAL purposes and without
  8.  * fee is hereby granted provided that this copyright notice
  9.  * appears in all copies. Please refer to the file "copyright.html"
  10.  * for further important copyright and licensing information.
  11.  *
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
  13.  * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
  14.  * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  15.  * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
  16.  * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
  17.  * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
  18.  */
  19.  
  20. package sun.awt.win32;
  21.  
  22. import java.awt.*;
  23. import java.io.*;
  24. import com.ms.awt.GraphicsX;
  25.  
  26. /** 
  27.  * A class which initiates and executes a Win32 print job.
  28.  *
  29.  * @version 1.0 24 Jan 1996
  30.  * @author Erik Gilbert
  31.  */
  32. public class Win32PrintJob /* extends PrintJob */ {
  33.     private     GraphicsX w32g;
  34.  
  35.     String       title;
  36.     Dimension      pageDimension;
  37.     int         pageResolution;
  38.     boolean      lastFirst = false;
  39.     int         pageCount = 0;
  40.     int      printerDC = 0;
  41.  
  42.     public Win32PrintJob(String title) throws IOException {
  43.     this.title = title;
  44.     pageDimension = new Dimension((96 * 17)/2, 11 * 96); //for now
  45.     pageResolution = 96; //for now
  46.     }
  47.  
  48.     /**
  49.      * Gets a Graphics object that will draw to the next page.
  50.      * The page is flushed to the printer when the graphics 
  51.      * object is disposed.
  52.      */
  53.     public Graphics getGraphics() {
  54.     
  55.     pageCount++;
  56.     w32g = new GraphicsX(this);
  57.  
  58.     return (Graphics)w32g;
  59.     }
  60.  
  61.     /**
  62.      * Returns the dimensions of the page in pixels.
  63.      */
  64.     public Dimension getPageDimension() {
  65.     return pageDimension;
  66.     }
  67.  
  68.     /**
  69.      * Returns the resolution of the page in pixels per inch.
  70.      */
  71.     public int getPageResolution() {
  72.     return pageResolution;
  73.     }
  74.  
  75.     /**
  76.      * Returns true if the last page should be printed first.
  77.      */
  78.     public boolean lastPageFirst() {
  79.     return lastFirst;
  80.     }
  81.  
  82.     /**
  83.      * Ends the print job and does cleanup.
  84.      */
  85.     public void end() {
  86.     w32g.close(this);
  87.     }
  88. }
  89.