Package jam.util
Class PrintUtilities
java.lang.Object
jam.util.PrintUtilities
- All Implemented Interfaces:
Printable
A simple utility class that lets you very simply print
an arbitrary component. Just pass the component to the
PrintUtilities.printComponent. The component you want to
print doesn't need a print method and doesn't have to
implement any interface or do anything special at all.
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.
-
Field Summary
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
-
Constructor Summary
ConstructorsConstructorDescriptionPrintUtilities
(Component componentToBePrinted) PrintUtilities
(Component componentToBePrinted, boolean scaled) -
Method Summary
Modifier and TypeMethodDescriptionstatic void
The speed and quality of printing suffers dramatically if any of the containers have double buffering turned on.static void
Re-enables double buffering globally.void
print()
int
print
(Graphics g, PageFormat pageFormat, int pageIndex) static void
static void
static int
printScaled
(Component componentToBePrinted, Graphics g, PageFormat pageFormat, int pageIndex) int
printScaled
(Graphics g, PageFormat pageFormat, int pageIndex)
-
Constructor Details
-
PrintUtilities
-
PrintUtilities
-
-
Method Details
-
printComponent
-
printComponentScaled
-
print
public void print() -
print
-
printScaled
-
printScaled
public static int printScaled(Component componentToBePrinted, Graphics g, PageFormat pageFormat, int pageIndex) -
disableDoubleBuffering
The speed and quality of printing suffers dramatically if any of the containers have double buffering turned on. So this turns if off globally. -
enableDoubleBuffering
Re-enables double buffering globally.
-