Packages
 In this topic

*Constructors

*Methods

 

Packages   PreviousThis PackageNext
Package com.ms.awt   Previous This
Package
Next

 


Class WPrintJob

public class WPrintJob extends PrintJob
{
  // Constructors
  public WPrintJob(String title) throws IOException;

  // Methods
  public void end();
  public Graphics getGraphics();
  public Dimension getPageDimension();
  public int getPageResolution();
  public boolean lastPageFirst();
  public void setPageDimensions(int width, int height);
}

This class creates Win32 WPrintJob objects that handle printing. This class is similar to the java.awt.PrintJob class, but includes the setPageDimensions method and other improvements.

Printing in Java is performed with this and other printing classes, and with the java.awt.Toolkit class. The following example shows how to use Toolkit to print from an applet.


Toolkit tools = getToolkit();
WPrintJob wpj = (WPrintJob)tools.getPrintJob(null, "Print?", null);
if(wpj != null)
{
     Graphics g = wpj.getGraphics(); 
     if(g != null)       
     { 
          paint(g);
          g.dispose();
     }
wpj.end();
}
PrintJob
  |
  +--WPrintJob

Constructors

WPrintJob

public WPrintJob(String title) throws IOException;

Creates a Win32 print job object with the specified title.

ParameterDescription
title The name of the print job.

Methods

end

public void end();

Ends the print job and performs cleanup operations.

Return Value:

No return value.

getGraphics

public Graphics getGraphics();

Retrieves a Graphics object that will draw to the next page. The page is flushed to the printer when the graphics object calls the dispose method.

Return Value:

Returns a Graphics object that draws to the printer.

getPageDimension

public Dimension getPageDimension();

Retrieves the dimensions of the page (in pixels).

Return Value:

Returns the Dimension of the page (in pixels). If the setPageDimensions has not been called, the Dimension object returned is a default Dimension.

getPageResolution

public int getPageResolution();

Retrieves the resolution of the page (in pixels per inch).

Return Value:

Returns the page resolution.

lastPageFirst

public boolean lastPageFirst();

Determines if the last page should be printed first.

Return Value:

Returns true if the last page should be printed first.

setPageDimensions

public void setPageDimensions(int width, int height);

Sets the logical page dimensions and enables you to effectively use a mapping mode (like GDI).

Return Value:

No return value.

ParameterDescription
width The width of the page (in pixels).
height The height of the page (in pixels).

upnrm.gif © 1998 Microsoft Corporation. All rights reserved. Terms of use.