voji.utils
Class PageGraphics

java.lang.Object
  |
  +--java.awt.Graphics
        |
        +--voji.utils.CopyGraphics
              |
              +--voji.utils.PageGraphics
All Implemented Interfaces:
java.awt.PrintGraphics

public class PageGraphics
extends CopyGraphics
implements java.awt.PrintGraphics

This class coveres another Graphics object giving printing attributes and a page number to it. The page number is counted automatically.


Field Summary
protected  int pageNumber
          The current page number
protected  java.awt.PrintJob printJob
          The covered print job
 
Constructor Summary
PageGraphics(java.awt.PrintJob printJob)
          Creates a new PageGraphics instance covering the given print job
 
Method Summary
 java.awt.Graphics create()
          Creates a new PageGraphics instance as a copy of the current object
 int getPageNumber()
          Returns the current page number
 java.awt.PrintJob getPrintJob()
          Returns the PrintJob object from which this PrintGraphics object originated
 void setGraphics(java.awt.Graphics graphics)
          Sets the current sub Graphics object.
 void setPageNumber(int number)
          Sets the current page number.
 int toPixels(double length)
          Returns the number of pixels of the given length
 java.lang.String toString()
          Returns a String object representing this object's value
 
Methods inherited from class voji.utils.CopyGraphics
addGraphics, addGraphics, clearRect, clipRect, copyArea, dispose, drawArc, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawLine, drawOval, drawPolygon, drawPolyline, drawRoundRect, drawString, drawString, fillArc, fillOval, fillPolygon, fillRect, fillRoundRect, finalize, getClip, getClipBounds, getColor, getFont, getFontMetrics, removeGraphics, setClip, setClip, setColor, setFont, setPaintMode, setXORMode, translate
 
Methods inherited from class java.awt.Graphics
create, draw3DRect, drawBytes, drawChars, drawPolygon, drawRect, fill3DRect, fillPolygon, getClipBounds, getClipRect, getFontMetrics, hitClip
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

printJob

protected java.awt.PrintJob printJob
The covered print job


pageNumber

protected int pageNumber
The current page number

Constructor Detail

PageGraphics

public PageGraphics(java.awt.PrintJob printJob)
Creates a new PageGraphics instance covering the given print job

Parameters:
printJob - the PrintJob to cover
Method Detail

create

public java.awt.Graphics create()
Creates a new PageGraphics instance as a copy of the current object

Overrides:
create in class CopyGraphics

toString

public java.lang.String toString()
Returns a String object representing this object's value

Overrides:
toString in class CopyGraphics
Returns:
a string representation of this graphics context

getPrintJob

public java.awt.PrintJob getPrintJob()
Returns the PrintJob object from which this PrintGraphics object originated

Specified by:
getPrintJob in interface java.awt.PrintGraphics

toPixels

public int toPixels(double length)
Returns the number of pixels of the given length

Parameters:
length - the length using the current page resolutions
Returns:
the number of pixels that are used by length

getPageNumber

public int getPageNumber()
Returns the current page number


setPageNumber

public void setPageNumber(int number)
Sets the current page number. You normally don't need to call this function directly.

Parameters:
number - the new page number
See Also:
setGraphics(Graphics)

setGraphics

public void setGraphics(java.awt.Graphics graphics)
Sets the current sub Graphics object. Each direct or indirect call to this function increases the current page number.

Overrides:
setGraphics in class CopyGraphics
Parameters:
graphics - the new sub Graphics object