de.saar.basic
Class ExportUtilities

Object
  extended by ExportUtilities

public class ExportUtilities
extends Object

This Class provides some utilities for printing SWING components. Components can be printed to a picture file, to a PDF or to a printer.

Author:
Michaela Regneri

Constructor Summary
ExportUtilities()
           
 
Method Summary
static void exportPDF(JComponent component, String filename)
          Prints a JComponent to a PDF.
static void exportPicture(JComponent comp, String name, String ext)
          Creates a picture out of a SWING component.
static void printComponent(Component c)
          Print a component with a printer.
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExportUtilities

public ExportUtilities()
Method Detail

printComponent

public static void printComponent(Component c)
Print a component with a printer. The standard printer dialog will be opened first.

Parameters:
c - the component to print

exportPDF

public static void exportPDF(JComponent component,
                             String filename)
                      throws IOException
Prints a JComponent to a PDF.

Parameters:
component - the component to print
filename - the filename of the PDF (has to end with .pdf)
Throws:
IOException

exportPicture

public static void exportPicture(JComponent comp,
                                 String name,
                                 String ext)
                          throws IOException
Creates a picture out of a SWING component.

Parameters:
comp - the component to export
name - the filename of the picture
ext - the picture type (the formats supported depend on platform and java version used)
Throws:
IOException
See Also:
ImageIO.getWriterFormatNames