public class PrintUtilities
extends java.lang.Object
implements java.awt.print.Printable
If you are going to be printing many times, it is marginally more efficient to first do the following:
PrintUtilities printHelper = new PrintUtilities(theComponent);then later do printHelper.print(). But this is a very tiny difference, so in most cases just do the simpler PrintUtilities.printComponent(componentToBePrinted). 7/99 Marty Hall, http://www.apl.jhu.edu/~hall/java/ May be freely used or adapted.
Constructor and Description |
---|
PrintUtilities(java.awt.Component componentToBePrinted) |
PrintUtilities(java.awt.Component componentToBePrinted,
boolean scaled) |
Modifier and Type | Method and Description |
---|---|
static void |
disableDoubleBuffering(java.awt.Component c)
The speed and quality of printing suffers dramatically if
any of the containers have double buffering turned on.
|
static void |
enableDoubleBuffering(java.awt.Component c)
Re-enables double buffering globally.
|
void |
print() |
int |
print(java.awt.Graphics g,
java.awt.print.PageFormat pageFormat,
int pageIndex) |
static void |
printComponent(java.awt.Component c) |
static void |
printComponentScaled(java.awt.Component c) |
static int |
printScaled(java.awt.Component componentToBePrinted,
java.awt.Graphics g,
java.awt.print.PageFormat pageFormat,
int pageIndex) |
int |
printScaled(java.awt.Graphics g,
java.awt.print.PageFormat pageFormat,
int pageIndex) |
public PrintUtilities(java.awt.Component componentToBePrinted)
public PrintUtilities(java.awt.Component componentToBePrinted, boolean scaled)
public static void printComponent(java.awt.Component c)
public static void printComponentScaled(java.awt.Component c)
public void print()
public int print(java.awt.Graphics g, java.awt.print.PageFormat pageFormat, int pageIndex)
print
in interface java.awt.print.Printable
public int printScaled(java.awt.Graphics g, java.awt.print.PageFormat pageFormat, int pageIndex)
public static int printScaled(java.awt.Component componentToBePrinted, java.awt.Graphics g, java.awt.print.PageFormat pageFormat, int pageIndex)
public static void disableDoubleBuffering(java.awt.Component c)
public static void enableDoubleBuffering(java.awt.Component c)
http://code.google.com/p/jam-lib/