com.jgoodies.uifextras.printing
Class PrintableDocument

java.lang.Object
  extended by com.jgoodies.uifextras.printing.PrintableDocument
All Implemented Interfaces:
Printable

public final class PrintableDocument
extends Object
implements Printable

Instances of PrintableDocument are printed by the PrintManager.

Version:
$Revision: 1.7 $
Author:
Karsten Lentzsch
See Also:
PrintManager

Field Summary
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Constructor Summary
PrintableDocument(Component component, boolean centerOutput)
          Constructs a printable document for the given component, centered or not.
PrintableDocument(String header, Component component, boolean centerOutput)
          Constructs a printable document for the given component, using the specified string header and centered property.
 
Method Summary
static PrintableDocument createFrom(ExtTable table)
          Creates and returns a PrintableDocument from the given extended table - that implicitly includes alignment data.
static PrintableDocument createFrom(TableModel model, int[] alignments)
          Creates and returns a PrintableDocument from the given table model and alignments array.
static PrintableDocument createFrom(URL url)
          Creates and returns a PrintableDocument from the text that is located at the specified URL.
 boolean getCenterOutput()
           
 Component getComponent()
           
 String getJobName()
           
 void print()
          Prints this printable document via the PrintManager.
 int print(Graphics g, PageFormat pf, int pageIndex)
           
 void printWithDialog()
          Prints this printable document via the PrintManager.
 void setFooter(String footer)
          Sets a string footer that is repeated on each page.
 void setHeader(String header)
          Sets a string header that is repeated on each page.
 void setJobName(String jobName)
          Sets a job name, that may be used by the OS or printer engine.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrintableDocument

public PrintableDocument(Component component,
                         boolean centerOutput)
Constructs a printable document for the given component, centered or not.


PrintableDocument

public PrintableDocument(String header,
                         Component component,
                         boolean centerOutput)
Constructs a printable document for the given component, using the specified string header and centered property.

Method Detail

createFrom

public static PrintableDocument createFrom(URL url)
Creates and returns a PrintableDocument from the text that is located at the specified URL.


createFrom

public static PrintableDocument createFrom(TableModel model,
                                           int[] alignments)
Creates and returns a PrintableDocument from the given table model and alignments array.


createFrom

public static PrintableDocument createFrom(ExtTable table)
Creates and returns a PrintableDocument from the given extended table - that implicitly includes alignment data.


getCenterOutput

public boolean getCenterOutput()

getComponent

public Component getComponent()

setHeader

public void setHeader(String header)
Sets a string header that is repeated on each page.


setFooter

public void setFooter(String footer)
Sets a string footer that is repeated on each page.


getJobName

public String getJobName()

setJobName

public void setJobName(String jobName)
Sets a job name, that may be used by the OS or printer engine.


print

public void print()
Prints this printable document via the PrintManager.


printWithDialog

public void printWithDialog()
Prints this printable document via the PrintManager. Opens a print dialog before, to allow the user to select a printer.


print

public int print(Graphics g,
                 PageFormat pf,
                 int pageIndex)
Specified by:
print in interface Printable


Copyright © 2000-2008 JGoodies Karsten Lentzsch. All Rights Reserved.