home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-01-27 | 2.3 KB | 89 lines |
- /*
- * @(#)Win32PrintJob.java 1.3 96/03/29 Erik Gilbert
- *
- * Copyright (c) 1996 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Permission to use, copy, modify, and distribute this software
- * and its documentation for NON-COMMERCIAL purposes and without
- * fee is hereby granted provided that this copyright notice
- * appears in all copies. Please refer to the file "copyright.html"
- * for further important copyright and licensing information.
- *
- * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
- * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
- * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
- */
-
- package sun.awt.win32;
-
- import java.awt.*;
- import java.io.*;
- import com.ms.awt.GraphicsX;
-
- /**
- * A class which initiates and executes a Win32 print job.
- *
- * @version 1.0 24 Jan 1996
- * @author Erik Gilbert
- */
- public class Win32PrintJob /* extends PrintJob */ {
- private GraphicsX w32g;
-
- String title;
- Dimension pageDimension;
- int pageResolution;
- boolean lastFirst = false;
- int pageCount = 0;
- int printerDC = 0;
-
- public Win32PrintJob(String title) throws IOException {
- this.title = title;
- pageDimension = new Dimension((96 * 17)/2, 11 * 96); //for now
- pageResolution = 96; //for now
- }
-
- /**
- * Gets a Graphics object that will draw to the next page.
- * The page is flushed to the printer when the graphics
- * object is disposed.
- */
- public Graphics getGraphics() {
-
- pageCount++;
- w32g = new GraphicsX(this);
-
- return (Graphics)w32g;
- }
-
- /**
- * Returns the dimensions of the page in pixels.
- */
- public Dimension getPageDimension() {
- return pageDimension;
- }
-
- /**
- * Returns the resolution of the page in pixels per inch.
- */
- public int getPageResolution() {
- return pageResolution;
- }
-
- /**
- * Returns true if the last page should be printed first.
- */
- public boolean lastPageFirst() {
- return lastFirst;
- }
-
- /**
- * Ends the print job and does cleanup.
- */
- public void end() {
- w32g.close(this);
- }
- }
-