jsky.util.gui
Class PrintUtil

java.lang.Object
  extended by jsky.util.gui.PrintUtil

public class PrintUtil
extends java.lang.Object

Utility class for displaying a print dialog to print a Printable object. This class uses a platform independent dialog and remembers the printer name and settings between sessions.


Constructor Summary
PrintUtil(java.awt.print.Printable p)
          Initialize with the Printable and the title
PrintUtil(java.awt.print.Printable p, java.lang.String title)
          Initialize with the Printable and the title
 
Method Summary
 ProgressPanel getProgressPanel()
          Return the panel used to display print progress.
 void print()
          Prints the contents of the target Printable.
static void print(java.awt.print.Printable p)
          Display a dialog to print the given Printable
static void print(java.awt.print.Printable p, java.lang.String title)
          Display a dialog to print the given Printable with the given title
 void print(java.lang.String title)
          Prints the contents of the target Printable.
 void setAttribute(javax.print.attribute.Attribute attr)
          Set the default value for the given attribute.
 void setTitle(java.lang.String title)
          Sets the title to be printed before the table contents.
 void setUseBgThread(boolean b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrintUtil

public PrintUtil(java.awt.print.Printable p)
Initialize with the Printable and the title


PrintUtil

public PrintUtil(java.awt.print.Printable p,
                 java.lang.String title)
Initialize with the Printable and the title

Method Detail

getProgressPanel

public ProgressPanel getProgressPanel()
Return the panel used to display print progress. This can be used to add extra feedback while printing.


print

public static void print(java.awt.print.Printable p,
                         java.lang.String title)
Display a dialog to print the given Printable with the given title


print

public static void print(java.awt.print.Printable p)
Display a dialog to print the given Printable


setTitle

public void setTitle(java.lang.String title)
Sets the title to be printed before the table contents.

Parameters:
title - title to print before the table

setAttribute

public void setAttribute(javax.print.attribute.Attribute attr)
Set the default value for the given attribute. For example, to set the default to landscape, pass OrientationRequested.LANDSCAPE


setUseBgThread

public void setUseBgThread(boolean b)

print

public void print(java.lang.String title)
           throws java.awt.print.PrinterException
Prints the contents of the target Printable.

Parameters:
title - the title for printing
Throws:
java.awt.print.PrinterException - thrown if any print-related errors occur

print

public void print()
           throws java.awt.print.PrinterException
Prints the contents of the target Printable.

Throws:
java.awt.print.PrinterException - thrown if any print-related errors occur