ikayaki.util
Class ComponentPrinter

java.lang.Object
  extended by ikayaki.util.ComponentPrinter
All Implemented Interfaces:
Printable

public class ComponentPrinter
extends Object
implements Printable

Offers methods to print Components (only for PrintPanel actually)

Author:
Aki Korpua

Field Summary
private  Component componentToBePrinted
          Component to be printed
private  int plotHeight
          plots height
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Constructor Summary
ComponentPrinter(Component componentToBePrinted)
          Creates new printable "component"
 
Method Summary
static void disableDoubleBuffering(Component c)
           
static void enableDoubleBuffering(Component c)
           
 int print(Graphics g, PageFormat pageFormat, int pageIndex)
          Absolutely chaotic printing mechanism.
 void print(String jobName)
          Opens printer dialog and start printing job if we get printer
static void printComponent(Component c)
          Static printing command
static void printComponent(Component c, String jobName)
          Static printing command
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

componentToBePrinted

private Component componentToBePrinted
Component to be printed


plotHeight

private final int plotHeight
plots height

See Also:
Constant Field Values
Constructor Detail

ComponentPrinter

public ComponentPrinter(Component componentToBePrinted)
Creates new printable "component"

Parameters:
componentToBePrinted - Component
Method Detail

printComponent

public static void printComponent(Component c)
Static printing command

Parameters:
c - Component to be printed (use Only PrintPanel)

printComponent

public static void printComponent(Component c,
                                  String jobName)
Static printing command

Parameters:
c - Component to be printed (use Only PrintPanel)
jobName - name for the printing job

print

public void print(String jobName)
Opens printer dialog and start printing job if we get printer


print

public int print(Graphics g,
                 PageFormat pageFormat,
                 int pageIndex)
Absolutely chaotic printing mechanism. Spilts component in pages and prevents last 400 pixels on last page to split awfully (we only use this for PrintPanel and last 400 pixels are Plots, so DONT use this in any other component printing :)

Specified by:
print in interface Printable
Parameters:
g - Graphics
pageFormat - PageFormat
pageIndex - int
Returns:
int

disableDoubleBuffering

public static void disableDoubleBuffering(Component c)

enableDoubleBuffering

public static void enableDoubleBuffering(Component c)