public class

ProxyPrintGraphics

extends ProxyGraphics
implements PrintGraphics
java.lang.Object
   ↳ java.awt.Graphics
     ↳ sun.print.ProxyGraphics
       ↳ sun.print.ProxyPrintGraphics

Class Overview

A subclass of Graphics that can be printed to. The graphics calls are forwared to another Graphics instance that does the actual rendering.

Summary

Public Constructors
ProxyPrintGraphics(Graphics graphics, PrintJob thePrintJob)
Public Methods
Graphics create()
Creates a new Graphics object that is a copy of this Graphics object.
Graphics create(int x, int y, int width, int height)
Creates a new Graphics object based on this Graphics object, but with a new translation and clip area.
void dispose()
Disposes of this graphics context and releases any system resources that it is using.
Graphics getGraphics()
PrintJob getPrintJob()
Returns the PrintJob object from which this PrintGraphics object originated.
[Expand]
Inherited Methods
From class sun.print.ProxyGraphics
From class java.awt.Graphics
From class java.lang.Object
From interface java.awt.PrintGraphics

Public Constructors

public ProxyPrintGraphics (Graphics graphics, PrintJob thePrintJob)

Public Methods

public Graphics create ()

Creates a new Graphics object that is a copy of this Graphics object.

Returns
  • a new graphics context that is a copy of this graphics context.

public Graphics create (int x, int y, int width, int height)

Creates a new Graphics object based on this Graphics object, but with a new translation and clip area. Refer to sun.print.ProxyGraphics#createGraphics for a complete description of this method.

Parameters
x the x coordinate.
y the y coordinate.
width the width of the clipping rectangle.
height the height of the clipping rectangle.
Returns
  • a new graphics context.

public void dispose ()

Disposes of this graphics context and releases any system resources that it is using. A Graphics object cannot be used after disposehas been called.

When a Java program runs, a large number of Graphics objects can be created within a short time frame. Although the finalization process of the garbage collector also disposes of the same system resources, it is preferable to manually free the associated resources by calling this method rather than to rely on a finalization process which may not run to completion for a long period of time.

Graphics objects which are provided as arguments to the paint and update methods of components are automatically released by the system when those methods return. For efficiency, programmers should call dispose when finished using a Graphics object only if it was created directly from a component or another Graphics object.

public Graphics getGraphics ()

public PrintJob getPrintJob ()

Returns the PrintJob object from which this PrintGraphics object originated.