|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent com.wildcrest.j2printerworks.J2Printer
A Java 2 component for printing one or more Pageables as a single document.
Supports headers & footers, date & page numbering, margins, orientation, scale, paper size,
background printing thread, printing progress events, Print Preview dialog, Page Setup dialog,
Pageable & Book support, print job name control, number of copies, n-up printing, print to HTML,
printer discovery and selection (1.4 or later),
print request attributes (1.4 or later), cross-platform dialogs (1.4 or later), and print to Postscript (1.4 or later).
Programs using the J2Printer class can build and run on all JDKs 1.2 or later.
Use the J2Printer14 subclass to access the JDK 1.4 printing features, but you must build and run under
JDK 1.4 or later.
(C) Copyright 2009, Wildcrest Associates (http://www.wildcrest.com). All rights reserved.
Nested Class Summary |
Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
static int |
BEFORE
Specifies that print preview dialog should be closed bringing up print dialog. |
static int |
BOTTOM
Specifies vertical alignment to be bottom justified within the available space. |
static int |
BOX
Specifies that a box is drawn around the header or the footer. |
static int |
CENTER
Specifies horizontal or vertical alignment to be centered within the available space. |
static int |
FIRST
Denotes values for page 1. |
static int |
GLOBAL
Indicates that the "global" (overall, default, J2Printer) values are to be used for margins, header/footer style, orientation, etc., as opposed to the "local" (individual Pageable) values. |
static int |
LANDSCAPE
Specifies that the page orientation is landscape (content rotated 90 degrees counter-clockwise relative to portrait). |
static int |
LEFT
Specifies horizontal alignment to be left justified within the available space. |
static int |
LINE
Specifies that a line is drawn below the header or above the footer. |
static int |
NEVER
Specifies that print preview dialog should be kept open until closed manually by user. |
static int |
NONE
Specifies that no additional line or box is drawn for the header or footer. |
static int |
OUTLINE
Specifies that an outline is drawn around the page image returned by getPageImage. |
static int |
PLAIN
Specifies that no outline is drawn around the page image returned by getPageImage. |
static int |
PORTRAIT
Specifies that the page orientation is portrait. |
static int |
PPI72
A constant specifying the standard printing resolution of 72 dots ("points") per inch. |
protected static java.awt.print.PrinterJob |
printerJob
|
protected static java.awt.print.PrinterJob |
printerJobSeparateThread
|
static int |
REST
Denotes values for pages 2...n. |
static int |
REVERSE_LANDSCAPE
Specifies that the page orientation is reverse landscape (landscape rotated 180 degrees). |
static int |
RIGHT
Specifies horizontal alignment to be right justified within the available space. |
static int |
SHADOW
Specifies that an outline and a drop shadow are drawn around the page image returned by getPageImage. |
static int |
TOP
Specifies vertical alignment to be top justified within the available space. |
static int |
WAIT
Specifies that print preview dialog should be closed after print dialog comes up (or after printing begins if not using print dialog). |
Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
J2Printer()
Construct a J2Printer object with no serial number, a default printer, and an empty Pageable. |
|
J2Printer(java.awt.print.PrinterJob printerJob)
Construct a J2Printer object with no serial number, a given PrinterJob, and an empty Pageable. |
|
J2Printer(java.lang.String serialNum)
Construct a J2Printer object with given serial number, default printer, and empty Pageable. |
|
J2Printer(java.lang.String serialNum,
java.awt.print.PrinterJob printerJob)
Construct a J2Printer object with given serial number and PrinterJob, and empty Pageable. |
Method Summary | |
void |
addPageable(java.awt.print.Pageable pageable)
Add specified Pageable to end of this J2Printer's current Pageables list. |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener l)
Add a PropertyChangeListener for this component |
void |
cancelPrinting()
Cancel the current printing job. |
void |
changePrintPreviewLookAndFeel(boolean change)
Method to control whether print preview dialog can temporarily change the Look And Feel when creating its user interface components (default: true). |
void |
clearFooters()
Clears all the "global" (overall, default) footers for both page 1 and pages 2...n to the empty String "". |
void |
clearFooters(int which)
Clears all the "global" (overall, default) footers for either page 1 of pages 2...n to the empty String "". |
void |
clearHeaders()
Clears all the "global" (overall, default) headers for both page 1 and pages 2...n to the empty String "" (NOTE: value cannot be changed in Free Trial Version). |
void |
clearHeaders(int which)
Clears all the "global" (overall, default) headers for either page 1 of pages 2...n to the empty String "" (NOTE: value cannot be changed in Free Trial Version). |
void |
clearPageable()
Remove all pages from this J2Printer's current Pageables list. |
static java.lang.Object |
clone(java.lang.Object obj)
Convenience method for cloning any Object in Java. |
void |
displayPDFFile(java.lang.String file)
Utility method for displaying the contents of a PDF file using Adobe Acrobat Reader (Windows only). |
void |
dispose()
Method used to dispose of all internal static J2Printer objects and set them to null, thereby freeing them up for garbage collection. |
void |
disposePageImageBuffers()
Method used in conjunction with getPageImage methods to dispose of the page image BufferedImages, freeing them up for garbage collection. |
protected void |
fire(java.lang.String propertyName)
Fire property change event for this component |
double |
getBodyHeight(int which)
Convenience method which returns the width of the body height (printable area inside the top and bottom margins, headers, footers, and gaps) based on the J2Printer "default" page settings. |
double |
getBodyWidth()
Convenience method which returns the width of the body width (printable area inside the left and right margins) based on the J2Printer "default" page settings. |
double |
getBottomMargin()
Returns the "global" (overall, default) bottom margin. |
java.lang.Object |
getCenterFooter()
Returns the "global" (overall, default) center footer (same as getCenterFooter(FIRST)). |
java.lang.Object |
getCenterFooter(int which)
Returns the "global" (overall, default) center footer for either page 1 or pages 2...n. |
java.lang.Object |
getCenterHeader()
Returns the "global" (overall, default) center header (same as getCenterHeader(FIRST)). |
java.lang.Object |
getCenterHeader(int which)
Returns the "global" (overall, default) center header for either page 1 or pages 2...n. |
int |
getCurrentPrintPreviewPageNumber()
Returns the current user-controlled print preview page number. |
double |
getCurrentPrintPreviewScale()
Returns the current user-specified print preview scaling factor. |
java.lang.Exception |
getException()
Returns the Exception (usually a java.awt.print.PrinterException) that occurred during printing. |
java.awt.Font |
getFooterFont()
Returns the "global" (overall, default) Font specified for footers (same as getFooterFont(FIRST) under assumption that footer fonts on all pages are the same). |
java.awt.Font |
getFooterFont(int which)
Returns the "global" (overall, default) Font for printing the footers for either page 1 or pages 2...n when these are specified using a String. |
int |
getFooterStyle()
Returns "global" (overall, default) footer style (returns answer for page 1). |
int |
getFooterStyle(int which)
Returns "global" (overall, default) footer style for either page 1 or pages 2...n. |
double |
getGapAboveFooter()
Returns the "global" (overall, default) gap between the last line and the footer in inches. |
double |
getGapBelowHeader()
Returns the "global" (overall, default) gap between the header and first line in inches. |
java.awt.Font |
getHeaderFont()
Returns the "global" (overall, default) Font specified for headers (same as getHeaderFont(FIRST) under assumption that header fonts on all pages are the same). |
java.awt.Font |
getHeaderFont(int which)
Returns the "global" (overall, default) Font for printing the headers for either page 1 or pages 2...n when these are specified using a String. |
int |
getHeaderStyle()
Returns the "global" (overall, default) header style (returns answer for page 1). |
int |
getHeaderStyle(int which)
Returns the "global" (overall, default) header style for either page 1 or pages 2...n. |
java.lang.Object |
getLeftFooter()
Returns the "global" (overall, default) left footer (same as getLeftFooter(FIRST)). |
java.lang.Object |
getLeftFooter(int which)
Returns the "global" (overall, default) left footer for either page 1 or pages 2...n. |
java.lang.Object |
getLeftHeader()
Returns the "global" (overall, default) left header (same as getLeftHeader(FIRST)). |
java.lang.Object |
getLeftHeader(int which)
Returns the "global" (overall, default) left header for either page 1 or pages 2...n. |
double |
getLeftMargin()
Returns the "global" (overall, default) left margin. |
java.awt.Dimension |
getMaximumSize()
Return maximum size of bean icon (32x32) for use in your visual builder. |
java.awt.Dimension |
getMinimumSize()
Return minimum size of bean icon (32x32) for use in your visual builder. |
int |
getNumberOfCopies()
Returns the number of copies of the document to be printed as set by setNumberOfCopies (or the Copies attribute set using setPrintRequestAttributeSet under J2Printer14). |
int |
getNup()
Returns the N-up value (number of page images printed per physical page). |
int |
getOrientation()
Returns the "global" (overall, default) page orientation (PORTRAIT, LANDSCAPE, or REVERSE_LANDSCAPE). |
java.awt.print.Pageable |
getPageable()
Returns the Pageable that will be printed. |
int |
getPageBeingPrinted()
Returns the current page being printed (1...n). |
java.awt.print.PageFormat |
getPageFormat()
Convenience method for creating a PageFormat instance based on this J2Printer's "global" margins, page size, & orientation. |
java.awt.image.BufferedImage |
getPageImage(int pageNumber)
Method for creating a BufferedImage representation of the specified page (1...n) of the current Pageable at screen resolution assuming a scale factor of 1.0 and a black box drawn around the outside edge of the page. |
java.awt.image.BufferedImage |
getPageImage(int pageNumber,
double scale,
boolean outline,
boolean reusable)
Deprecated. Use instead
getPageImage(pageNumber, scale, border, reusable)
where border = 0 if outline false and border = 1 if outline true. |
java.awt.image.BufferedImage |
getPageImage(int pageNumber,
double scale,
int border,
boolean reusable)
Method for creating a BufferedImage representation of the specified page (1...n) of the current Pageable at screen resolution with a given scale factor and optional black box drawn around the outside edge of the page. |
java.awt.image.BufferedImage |
getPageImage(java.awt.print.Pageable pageable,
int pageNumber,
double scale,
boolean outline,
boolean reusable)
Deprecated. Use instead
getPageImage(pageable, pageNumber, scale, border, reusable)
where border = 0 if outline false and border = 1 if outline true. |
java.awt.image.BufferedImage |
getPageImage(java.awt.print.Pageable pageable,
int pageNumber,
double scale,
int border,
boolean reusable)
Method for creating a BufferedImage representation of the specified page (1...n) of a specified Pageable at screen resolution with a given scale factor and optional black box drawn around the outside edge of the page. |
double |
getPaperHeight()
Returns the "global" (overall, default) paper height in 1/72nds of an inch with paper viewed in PORTRAIT. |
double |
getPaperWidth()
Returns the "global" (overall, default) paper width in 1/72nds of an inch with paper viewed in PORTRAIT. |
java.awt.Component |
getParentFrame()
Returns the parent Frame (or JFrame, JDialog, JWindow, JApplet, or JInternalFrame) over which model print dialogs and wait cursors are displayed. |
java.awt.Dimension |
getPreferredSize()
Return preferred size of bean icon (32x32) for use in your visual builder. |
java.awt.print.PrinterJob |
getPrinterJob()
Returns the currently specified PrinterJob used by J2Printer. |
java.lang.String |
getPrintJobName()
Returns the print job name for this document as set by setPrintJobName (or the JobName attribute set using setPrintRequestAttributeSet under J2Printer14) |
int |
getPrintPreviewCloseOnPrint()
Returns value of the print preview dialog close-on-print setting (J2Printer.BEFORE, .WAIT, or .NEVER). |
int |
getPrintPreviewPageNumber()
Returns the starting print preview page number. |
java.awt.Dialog |
getPrintPreviewPageSetupDialog()
Returns the current print preview dialog's page setup Dialog. |
double |
getPrintPreviewScale()
Returns the starting print preview scaling factor. |
java.lang.String |
getPrintPreviewString(java.lang.String name)
Deprecated. Use customizable print preview toolbar mechanism to find out print preview toolbar strings and/or tooltips (see J2Printer documentation). NOTE: calling this method restores the print preview toolbar to its default appearance. |
javax.swing.JToolBar |
getPrintPreviewToolBar()
Method for gaining access to the print preview dialog toolbar for purposes of customization (see J2PrinterWorks documentation for J2Printer). |
java.lang.Object |
getRightFooter()
Returns the "global" (overall, default) right footer (same as getRightFooter(FIRST)). |
java.lang.Object |
getRightFooter(int which)
Returns the "global" (overall, default) right footer for either page 1 or pages 2...n. |
java.lang.Object |
getRightHeader()
Returns the "global" (overall, default) right header (same as getRightHeader(FIRST)). |
java.lang.Object |
getRightHeader(int which)
Returns the "global" (overall, default) right header for either page 1 or pages 2...n. |
double |
getRightMargin()
Returns the "global" (overall, default) right margin. |
double |
getScale()
Returns the "global" (overall, default) magnification or minification scaling factor for printing. |
int |
getStartingPageNumber()
Returns the starting page number, that is, the number used to number the first page of the document. |
double |
getTopMargin()
Returns the "global" (overall, default) top margin. |
static java.lang.String |
getVersion()
Returns the J2PrinterWorks version number. |
boolean |
isCrossPlatformDialogs()
Returns whether J2Printer is using cross platform dialogs (overridden in J2Printer14 subclass, J2Printer always returns false) |
boolean |
isCurrentPrintPreviewTwoPageDisplay()
Returns whether print preview dialog is currently in one or two page display mode as specified by the user. |
boolean |
isDebug()
Returns whether stack trace and other debug information will print to System.err when errors are encountered (default: true). |
boolean |
isPrintDialogResponse()
Returns the most recent user response to the print dialog box, true = "OK" or false = "cancel". |
boolean |
isPrintDialogUsed()
Returns whether to display a print dialog before printing. |
boolean |
isPrintingUnderway()
Returns whether printing is underway. |
boolean |
isPrintPreviewClosed()
Returns whether the print preview dialog is open or closed. |
boolean |
isPrintPreviewTwoPageDisplay()
Returns whether print preview dialog starts in one or two page display mode. |
boolean |
isSeparatePrintThread()
Returns whether printing will be performed from a separate thread. |
java.awt.print.Pageable |
joinPageables(java.awt.print.Pageable pageable1,
java.awt.print.Pageable pageable2)
Create new Pageable out of two existing Pageables. |
static void |
main(java.lang.String[] args)
Double click on J2PrinterWorks.jar to find out its version number and date. |
javax.swing.JPanel |
makePagePanel(int which)
Convenience factory method to create a JPanel whose size is the same size as the body of a printable page based on the J2Printer "default" settings. |
java.awt.print.Pageable |
mergePageables(java.util.Vector pageables)
Create new Pageable out of a vector of existing Pageables |
void |
paint(java.awt.Graphics g)
This method is provided to paint the J2Printer bean icon in your visual builder. |
void |
print()
Method for printing the current Pageable (specified using setPageable) |
void |
print(java.awt.print.Pageable pageable)
Method for printing any Pageable (or Book) |
void |
printPDFFile(java.lang.String file)
Utility method for printing the contents of a PDF file on the current printer (Windows only). |
void |
printToHTML(java.lang.String dir,
java.lang.String file,
double scale,
boolean slideshow)
Utility method for saving a facsimile of the printed document either as a single HTML file containing all the page images or as a series of HTML pages suitable for display in a browser as a slide show. |
byte[] |
printToPDF()
Utility method for printing the current document to PDF stored in an in-memory byte array. |
void |
printToPDF(java.io.OutputStream outputStream)
Utility method for printing the current document to PDF and storing in a provided OutputStream. |
void |
printToPDF(java.lang.String file)
Utility method for printing the current document to a PDF (.pdf) file. |
byte[] |
printToPDFNoFonts()
Utility method for printing the current document to PDF stored in an in-memory byte array that relies on no PDF fonts. |
void |
printToPDFNoFonts(java.io.OutputStream outputStream)
Utility method for printing the current document to PDF and storing in a provided OutputStream that relies on no PDF fonts. |
void |
printToPDFNoFonts(java.lang.String file)
Utility method for printing the current document to a PDF (.pdf) file that relies on no PDF fonts. |
void |
refreshPrintPreviewDialog()
Method for refreshing the print preview dialog window using the current settings. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener l)
Remove a PropertyChangeListener for this component |
void |
saveImageToJPEG(java.awt.image.BufferedImage image,
java.lang.String fileName)
Utility method for saving a BufferedImage to a JPEG file. |
void |
setBottomMargin(double bottomMargin)
Sets the "global" (overall, default) bottom margin below footer in inches from the edge of the page (when viewing content). |
static void |
setBusyCursor(java.awt.Component parent,
boolean busy)
Convenience method that sets the cursor on your Frame (or JFrame, JDialog, JWindow, JApplet, or JInternalFrame) to Cursor.WAIT_CURSOR if busy is true, and to Cursor.DEFAULT_CURSOR if busy is false. |
void |
setCenterFooter(int which,
java.lang.Object centerFooter)
Sets the "global" (overall, default) center footer for either page 1 or pages 2...n using a String or JLabel |
void |
setCenterFooter(java.lang.Object centerFooter)
Sets the "global" (overall, default) center footer for both page 1 and pages 2...n using a String or JLabel. |
void |
setCenterHeader(int which,
java.lang.Object centerHeader)
Sets the "global" (overall, default) center header for either page 1 or pages 2...n using a String or JLabel (NOTE: value cannot be changed in Free Trial Version). |
void |
setCenterHeader(java.lang.Object centerHeader)
Sets the "global" (overall, default) center header for both page 1 and pages 2...n using a String or JLabel (NOTE: value cannot be changed in Free Trial Version). |
void |
setDebug(boolean debug)
Specifies whether stack trace and other debug information will print to System.err when errors are encountered. |
void |
setFooterFont(java.awt.Font font)
Sets the "global" (overall, default) Font for printing the footers for both page 1 and pages 2...n when these are specified using a String. |
void |
setFooterFont(int which,
java.awt.Font font)
Sets the "global" (overall, default) Font for printing the footers for either page 1 or pages 2...n when these are specified using a String. |
void |
setFooterStyle(int style)
Sets "global" (overall, default) footer style for both page 1 and pages 2...n. |
void |
setFooterStyle(int which,
int style)
Sets "global" (overall, default) footer style for either page 1 or pages 2...n. |
void |
setGapAboveFooter(double gapAboveFooter)
Sets the "global" (overall, default) gap between the bottom of the last line of body and the top of the footer in inches. |
void |
setGapBelowHeader(double gapBelowHeader)
Sets the "global" (overall, default) gap between the bottom of the header and the top of the first line of body in inches. |
void |
setHeaderFont(java.awt.Font font)
Sets the "global" (overall, default) Font for printing the headers for both page 1 and pages 2...n when these are specified using a String (NOTE: value cannot be changed in Free Trial Version). |
void |
setHeaderFont(int which,
java.awt.Font font)
Sets the "global" (overall, default) Font for printing the headers for either page 1 or pages 2...n when these are specified using a String (NOTE: value cannot be changed in Free Trial Version). |
void |
setHeaderStyle(int style)
Sets the "global" (overall, default) header style for both page 1 and pages 2...n (NOTE: value cannot be changed in Free Trial Version). |
void |
setHeaderStyle(int which,
int style)
Sets the "global" (overall, default) header style for either page 1 or pages 2...n (NOTE: value cannot be changed in Free Trial Version). |
void |
setLeftFooter(int which,
java.lang.Object leftFooter)
Sets the "global" (overall, default) left footer for either page 1 or pages 2...n using a String or JLabel |
void |
setLeftFooter(java.lang.Object leftFooter)
Sets the "global" (overall, default) left footer for both page 1 and pages 2...n using a String or JLabel. |
void |
setLeftHeader(int which,
java.lang.Object leftHeader)
Sets the "global" (overall, default) left header for either page 1 or pages 2...n using a String or JLabel (NOTE: value cannot be changed in Free Trial Version). |
void |
setLeftHeader(java.lang.Object leftHeader)
Sets the "global" (overall, default) left header for both page 1 and pages 2...n using a String or JLabel. |
void |
setLeftMargin(double leftMargin)
Sets the "global" (overall, default) left margin in inches from the edge of the page (when viewing content). |
void |
setNumberOfCopies(int numberOfCopies)
Sets number of copies to be printed (and appear in the print dialog). |
void |
setNumberOfPageImageBuffers(int numberBuffers)
Method used in conjunction with getPageImage methods, and thereby the print preview dialog, specifying how many BufferedImages can be allocated simultaneously before their space gets reused. |
void |
setNup(int nup)
Sets printing to use N-up formating (N page images per physical page), where N=1, 2, 4, 6, 9, or 16, or minus these same values, where the minus sign means suppress the drawing of the page outlines. |
void |
setOrientation(int orientation)
Sets "global" (overall, default) page orientation (causes corresponding reordering of unprintable margin settings) |
void |
setPageable(java.awt.print.Pageable pageable)
Specifies the Pageable that will be printed. |
void |
setPageFormat(java.awt.print.PageFormat pageFormat)
Convenience method for setting this J2Printer's "global" margins, page size, and orientation from an external PageFormat instance. |
void |
setPageImagesMonochrome(boolean monochrome)
Method used in conjunction with the getPageImage methods, and thereby the print preview dialog page images, specifying whether the images are monochrome (grayscale) instead of color (default: false = color). |
void |
setPaperSize(double paperW,
double paperH)
Sets the "global" (overall, default) paper width and height in 1/72nds of an inch when paper viewed in PORTRAIT. |
void |
setParam(java.lang.String str)
Method for entering internal parameters, such as the J2PrinterWorks serial number. |
void |
setParentFrame(java.awt.Component parent)
Set the parent Frame (or JFrame, JDialog, JWindow, JApplet, or JInternalFrame) from which the print dialog, print preview, and page setup modal dialogs are displayed. |
void |
setPrintDialogUsed(boolean printDialogUsed)
Sets whether to show a print dialog before printing. |
void |
setPrinterJob(java.awt.print.PrinterJob printerJob)
Use the specified PrinterJob for J2Printer printing. |
void |
setPrintJobName(java.lang.String printJobName)
Sets the print job name that appears in the system print monitor. |
void |
setPrintPreviewCloseOnPrint(int closeOnPrint)
Specifies whether and when the print preview dialog will close when user hits "Print" button. |
void |
setPrintPreviewDialogZoomLevels(int[] zoomLevels)
Method used to change the print preview dialog zoom levels. |
void |
setPrintPreviewIconImage(java.awt.Image icon)
Method to set the icon image in the upper left hand corner of the print preview dialog (default: same as parent frame). |
void |
setPrintPreviewPageNumber(int pageNumber)
Sets the starting page number displayed in the print preview dialog. |
void |
setPrintPreviewPageSetupDialog(java.awt.Dialog dialog)
Sets the page setup dialog to display when user hits "Page Setup" button in print preview dialog. |
void |
setPrintPreviewScale(double printPreviewScale)
Sets the starting magnification/minification scale of the print preview dialog. |
void |
setPrintPreviewString(java.lang.String name,
java.lang.String value)
Deprecated. Use customizable print preview toolbar mechanism to change print preview toolbar strings and/or tooltips (see J2Printer documentation). NOTE: calling this method restores the print preview toolbar to its default appearance. |
void |
setPrintPreviewTwoPageDisplay(boolean twoPageDisplay)
Specifies whether print preview dialog starts in one or two page display mode. |
void |
setRightFooter(int which,
java.lang.Object rightFooter)
Sets the "global" (overall, default) right footer for either page 1 or pages 2...n using a String or JLabel. |
void |
setRightFooter(java.lang.Object rightFooter)
Sets the "global" (overall, default) right footer for both page 1 and pages 2...n using a String or JLabel. |
void |
setRightHeader(int which,
java.lang.Object rightHeader)
Sets the "global" (overall, default) right header for either page 1 or pages 2...n using a String or JLabel (NOTE: value cannot be changed in Free Trial Version). |
void |
setRightHeader(java.lang.Object rightHeader)
Sets the "global" (overall, default) right header for both page 1 and pages 2...n using a String or JLabel (NOTE: value cannot be changed in Free Trial Version). |
void |
setRightMargin(double rightMargin)
Sets the "global" (overall, default) right margin in inches from the edge of the page (when viewing content). |
void |
setScale(double scale)
Sets "global" (overall, default) magnification or minification scaling factor for printing. |
void |
setSeparatePrintThread(boolean separatePrintThread)
Sets whether to print from a separate thread (instead of from the same thread that called the print method). |
void |
setStartingPageNumber(int startingPageNumber)
Sets the starting page number, that is, the number used to number the first page of the document. |
void |
setTopMargin(double topMargin)
Sets the "global" (overall, default) top margin above header in inches from the edge of the page when viewing content). |
java.awt.print.PageFormat |
showPageSetupDialog()
Method for showing the standard Page Setup dialog with the current J2Printer (overall, default) orientation and margin settings. |
java.awt.print.PageFormat |
showPageSetupDialog(J2Pageable pageable)
Method for showing the standard Page Setup dialog with the specified J2Pageable's orientation and margin settings. |
void |
showPrintPreviewDialog()
Method for showing a modal Print Preview dialog for this J2Printer instance's current Pageable. |
void |
showPrintPreviewDialog(java.awt.Component parent)
Method for showing a modal Print Preview dialog for this J2Printer instance's current Pageable. |
void |
showPrintPreviewDialog(java.awt.Container parent,
java.awt.print.Pageable pageable)
Method for showing a modal Print Preview dialog for any Pageable (including non-J2PrinterWorks Pageables). |
void |
showPrintPreviewDialog(java.awt.print.Pageable pageable)
Method for showing a modal Print Preview dialog for any Pageable (including non-J2PrinterWorks Pageables). |
void |
showPrintPreviewPageSetupButton(boolean showPageSetupButton)
Deprecated. Use customizable print preview toolbar mechanism to add or remove buttons (see J2Printer documentation). |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int FIRST
public static final int REST
public static final int NONE
public static final int LINE
public static final int BOX
public static final int PLAIN
public static final int OUTLINE
public static final int SHADOW
public static final int LANDSCAPE
public static final int PORTRAIT
public static final int REVERSE_LANDSCAPE
public static final int CENTER
public static final int LEFT
public static final int RIGHT
public static final int TOP
public static final int BOTTOM
public static final int BEFORE
public static final int WAIT
public static final int NEVER
public static final int PPI72
public static final int GLOBAL
protected static java.awt.print.PrinterJob printerJob
protected static java.awt.print.PrinterJob printerJobSeparateThread
Constructor Detail |
public J2Printer()
public J2Printer(java.awt.print.PrinterJob printerJob)
public J2Printer(java.lang.String serialNum)
public J2Printer(java.lang.String serialNum, java.awt.print.PrinterJob printerJob)
Method Detail |
public void setParam(java.lang.String str)
public void setPrinterJob(java.awt.print.PrinterJob printerJob)
printerJob
- PrinterJob to use for printing. PrinterJob instance will also be used to set the
number of copies
and print job name. If null, the default printer will be used, with 1 copy, and job name
"J2PrinterWorks print document".public java.awt.print.PrinterJob getPrinterJob()
public java.awt.print.Pageable mergePageables(java.util.Vector pageables)
pageables
- A Vector of Pageables
public java.awt.print.Pageable joinPageables(java.awt.print.Pageable pageable1, java.awt.print.Pageable pageable2)
pageable1
- pageable2
-
public java.awt.print.PageFormat showPageSetupDialog()
public java.awt.print.PageFormat showPageSetupDialog(J2Pageable pageable)
pageable
- Pageable whose orientation and margin settings will be displayedpublic void print(java.awt.print.Pageable pageable)
pageable
- Pageable (or Book) that will be printedpublic void print()
public void cancelPrinting()
public void showPrintPreviewDialog(java.awt.Container parent, java.awt.print.Pageable pageable)
parent
- The parent Frame (or JFrame, JDialog, JWindow, JApplet, or JInternalFrame) from which
the dialog is displayed. Causes these windows to be treated as a group when clicked on to minimize
or "bring to front". If no parent frame or you don't care about window management, use null for
this argument.pageable
- Pageable the Pageable (or Book) for which to show the print preview.setPrintPreviewScale(double)
,
setPrintPreviewPageNumber(int)
,
setPrintPreviewTwoPageDisplay(boolean)
,
setPrintPreviewPageSetupDialog(Dialog)
,
showPrintPreviewPageSetupButton(boolean)
public void showPrintPreviewDialog(java.awt.Component parent)
parent
- The parent Frame (or JFrame, JDialog, JWindow, JApplet, or JInternalFrame) from which
the dialog is displayed. Causes these windows to be treated as a group when clicked on to minimize
or "bring to front". If no parent frame or you don't care about window management, use null for
this argument.setPrintPreviewScale(double)
,
setPrintPreviewPageNumber(int)
,
setPrintPreviewTwoPageDisplay(boolean)
,
setPrintPreviewPageSetupDialog(Dialog)
,
showPrintPreviewPageSetupButton(boolean)
public void showPrintPreviewDialog()
setPrintPreviewScale(double)
,
setPrintPreviewPageNumber(int)
,
setPrintPreviewTwoPageDisplay(boolean)
,
setPrintPreviewPageSetupDialog(Dialog)
,
showPrintPreviewPageSetupButton(boolean)
,
setParentFrame(Component)
public void showPrintPreviewDialog(java.awt.print.Pageable pageable)
pageable
- Pageable the Pageable (or Book) for which to show the print preview.setPrintPreviewScale(double)
,
setPrintPreviewPageNumber(int)
,
setPrintPreviewTwoPageDisplay(boolean)
,
setPrintPreviewPageSetupDialog(Dialog)
,
showPrintPreviewPageSetupButton(boolean)
,
setParentFrame(Component)
public void changePrintPreviewLookAndFeel(boolean change)
change
- boolean specifying whether the print preview dialog can temporarily change the
Look and Feel when creating user interface componentspublic javax.swing.JToolBar getPrintPreviewToolBar()
public void refreshPrintPreviewDialog()
public void showPrintPreviewPageSetupButton(boolean showPageSetupButton)
public void setPrintPreviewIconImage(java.awt.Image icon)
icon
- Image specifying the Image to use for the print preview dialog icon imagepublic void setPrintPreviewString(java.lang.String name, java.lang.String value)
setString("PRINTPREVIEW", "This string specifies the Print Preview dialog title bar");
name
- String specifying which string to change, legal arguments are:
PRINT, PREVIOUSPAGE, NEXTPAGE, PAGESETUP, DONE, FIRSTPAGE, LASTPAGE,
ZOOMOUT, ZOOMIN, TWOPAGEDISPLAY, ONEPAGEDISPLAY, PAGE, OF, PRINTPREVIEW.value
- String specifying new value for this string.public java.lang.String getPrintPreviewString(java.lang.String name)
getString("PRINTPREVIEW");
name
- String specifying which string to change, legal arguments are:
PRINT, PREVIOUSPAGE, NEXTPAGE, PAGESETUP, DONE, FIRSTPAGE, LASTPAGE,
ZOOMOUT, ZOOMIN, TWOPAGEDISPLAY, ONEPAGEDISPLAY, PAGE, OF, PRINTPREVIEW.public static void setBusyCursor(java.awt.Component parent, boolean busy)
parent
- the Frame (or JFrame, JDialog, JWindow, JApplet, or JInternalFrame),
over which the cursor will be changed (no change to cursor if null).busy
- boolean specifying WAIT_CURSOR if true, DEFAULT_CURSOR if false.public void setParentFrame(java.awt.Component parent)
parent
- the Frame (or JFrame, JDialog, JWindow, JApplet, or JInternalFrame)
from which the print dialog, print preview, and page setup will be displayed.public java.awt.Component getParentFrame()
public java.awt.image.BufferedImage getPageImage(int pageNumber)
pageNumber
- the number of the page (1...n) to be returned as an Image.
saveImageToJPEG(java.awt.image.BufferedImage, java.lang.String)
public java.awt.image.BufferedImage getPageImage(int pageNumber, double scale, boolean outline, boolean reusable)
getPageImage(pageNumber, scale, border, reusable)
where border = 0 if outline false and border = 1 if outline true.
pageNumber
- the number of the page (1...n) to be returned as an Image.scale
- double specifying the minification/magnification factor for the Image.outline
- boolean specifying whether to draw a black box around the outside edge of the page.reusable
- boolean where "true" means it is OK to reuse this BufferedImage when a later call
on getPageImage is made and "false" means create a new, independent BufferedImage allocated on the
heap that will not be reused.
Specifying reusable = "true" means that this returned BufferedImage becomes invalid after a certain
number of setPageImage calls, where this number is specified by the method
setNumberOfPageImageBuffers and has a default value of 1.
saveImageToJPEG(java.awt.image.BufferedImage, java.lang.String)
public java.awt.image.BufferedImage getPageImage(java.awt.print.Pageable pageable, int pageNumber, double scale, boolean outline, boolean reusable)
getPageImage(pageable, pageNumber, scale, border, reusable)
where border = 0 if outline false and border = 1 if outline true.
pageable
- the Pageable to be imaged.pageNumber
- the number of the page (1...n) to be returned as an Image.scale
- double specifying the minification/magnification factor for the Image.outline
- boolean specifying whether to draw a black box around the outside edge of the page.reusable
- boolean where "true" means it is OK to reuse this BufferedImage when a later call
getPageImage is made and "false" means create a new, independent BufferedImage allocated on the
heap that will not be reused. Specifying reusable = "true" means that this returned BufferedImage
becomes invalid after a certain number of setPageImage calls, where this number is specified by
the method setNumberOfPageImageBuffers and has a default value of 1.
saveImageToJPEG(java.awt.image.BufferedImage, java.lang.String)
public java.awt.image.BufferedImage getPageImage(int pageNumber, double scale, int border, boolean reusable)
pageNumber
- the number of the page (1...n) to be returned as an Image.scale
- double specifying the minification/magnification factor for the Image.border
- int where border = .PLAIN means draw no border, = .OUTLINE
means draw a black box around the outside edge of the page,
= .SHADOW means draw black box around the outside edge of page as well as a drop shadow.reusable
- boolean where "true" means it is OK to reuse this BufferedImage when a later call
on getPageImage is made and "false" means create a new, independent BufferedImage allocated on the
heap that will not be reused.
Specifying reusable = "true" means that this returned BufferedImage becomes invalid after a certain
number of setPageImage calls, where this number is specified by the method
setNumberOfPageImageBuffers and has a default value of 1.
saveImageToJPEG(java.awt.image.BufferedImage, java.lang.String)
public java.awt.image.BufferedImage getPageImage(java.awt.print.Pageable pageable, int pageNumber, double scale, int border, boolean reusable)
pageable
- the Pageable to be imaged.pageNumber
- the number of the page (1...n) to be returned as an Image.scale
- double specifying the minification/magnification factor for the Image.border
- int where border = .NONE (0) means draw no border, = .OUTLINE (1)
means draw a black box around the outside edge of the page,
= .SHADOW (2) means draw black box around the outside edge of page as well as a drop shadow.reusable
- boolean where "true" means it is OK to reuse this BufferedImage when a later call
getPageImage is made and "false" means create a new, independent BufferedImage allocated on the
heap that will not be reused. Specifying reusable = "true" means that this returned BufferedImage
becomes invalid after a certain number of setPageImage calls, where this number is specified by
the method setNumberOfPageImageBuffers and has a default value of 1.
saveImageToJPEG(java.awt.image.BufferedImage, java.lang.String)
public void setNumberOfPageImageBuffers(int numberBuffers)
numberBuffers
- int specifying the number of BufferedImages that can be allocated
simultaneously before being reused.public void disposePageImageBuffers()
public void setPageImagesMonochrome(boolean monochrome)
monochrome
- boolean if true then the getPageImage methods and print preview dialog page
images will be
drawn in monochrome (8-bit gray scale), whereas if false then images are drawn in color (int RGB).public void setPrintPreviewDialogZoomLevels(int[] zoomLevels)
zoomLevels
- int[] an array of desired zoom levels expressed in percent and in low-to-high order.
Default values are { 25, 35, 50, 75, 100, 125, 150, 200, 300, 400 }.public void saveImageToJPEG(java.awt.image.BufferedImage image, java.lang.String fileName)
image
- An instance of BufferedImage to be saved.fileName
- A String giving the file name in which to save the BufferedImage (all folders
in path must already exist).getPageImage(int)
public void printToHTML(java.lang.String dir, java.lang.String file, double scale, boolean slideshow)
dir
- The file system path name to a directory where all the HTML files will be created
(if missing, assumes ".", all folders in path must already exist).file
- The HTML file name that is to be the main window of the slide show (if missing,
assumes index.html, if doesn't end in .html, will add .html).scale
- The scale factor (1.0 means 100%) for scaling the page images for display.slideshow
- Specifies whether to generate an HTML slide show (true) or a single HTML file (false).public void printToPDF(java.lang.String file)
file
- The file name into which the PDF file will be written (if missing,
assumes ./out.pdf, if doesn't end in .pdf, will add .pdf, all folders in path must already exist).public byte[] printToPDF()
public void printToPDF(java.io.OutputStream outputStream)
outputStream
- A provided java.io.OutputStream into which the PDF will be written.public void printToPDFNoFonts(java.lang.String file)
file
- The file name into which the PDF file will be written (if missing,
assumes ./out.pdf, if doesn't end in .pdf, will add .pdf, all folders in path must already exist).public byte[] printToPDFNoFonts()
public void printToPDFNoFonts(java.io.OutputStream outputStream)
outputStream
- A provided java.io.OutputStream into which the PDF will be written.public void printPDFFile(java.lang.String file)
public void displayPDFFile(java.lang.String file)
public void paint(java.awt.Graphics g)
g
- Graphics context objectpublic java.awt.Dimension getPreferredSize()
public java.awt.Dimension getMinimumSize()
public java.awt.Dimension getMaximumSize()
public static java.lang.Object clone(java.lang.Object obj)
JTable cloneJTable = (JTable) clone(yourJTable);
;TreeModel cloneTreeModel = (TreeModel) clone(yourJTree.getModel());
;JTree newJTree = new JTree();
;newJTree.setModel(cloneTreeModel);
;
obj
- Object to be cloned.
CloneException
- if unable to serialize Object.public void setPageFormat(java.awt.print.PageFormat pageFormat)
pageFormat
- PageFormat whose values will be used to set the J2Printer margins, page size,
and orientation.public java.awt.print.PageFormat getPageFormat()
public javax.swing.JPanel makePagePanel(int which)
which
- J2Pageable.FIRST (1) if page 1, or J2Pageable.REST (0) if pages 2...n.public double getBodyWidth()
public double getBodyHeight(int which)
which
- J2Pageable.FIRST (1) if page 1, or J2Pageable.REST (0) if pages 2...n.public boolean isCrossPlatformDialogs()
public void dispose()
public void setPageable(java.awt.print.Pageable pageable)
pageable
- the Pageable that will be printedpublic void clearPageable()
public void addPageable(java.awt.print.Pageable pageable)
public java.awt.print.Pageable getPageable()
public void setDebug(boolean debug)
debug
- boolean specifying whether or not to print stack trace and debug information to
System.err (default: true)public boolean isDebug()
public void setPrintJobName(java.lang.String printJobName)
printJobName
- String representing the print job name. Default: "J2PrinterWorks print document"public java.lang.String getPrintJobName()
public void setNumberOfCopies(int numberOfCopies)
numberOfCopies
- the number of copies of the document to be printed. Default: 1public int getNumberOfCopies()
public void setPrintDialogUsed(boolean printDialogUsed)
printDialogUsed
- boolean representing whether to display a print dialog before printing.
Default: truepublic boolean isPrintDialogUsed()
public void setSeparatePrintThread(boolean separatePrintThread)
separatePrintThread
- boolean representing whether to print from a separate thread. Default: truepublic boolean isSeparatePrintThread()
public boolean isPrintingUnderway()
public int getPageBeingPrinted()
public boolean isPrintDialogResponse()
public boolean isPrintPreviewClosed()
public java.lang.Exception getException()
public void setPrintPreviewScale(double printPreviewScale)
printPreviewScale
- starting scaling factor for print preview dialog (default 1.0)public double getPrintPreviewScale()
public double getCurrentPrintPreviewScale()
public void setPrintPreviewPageNumber(int pageNumber)
pageNumber
- starting page number displayed in the print preview dialog (default 1)public int getPrintPreviewPageNumber()
public int getCurrentPrintPreviewPageNumber()
public void setPrintPreviewTwoPageDisplay(boolean twoPageDisplay)
twoPageDisplay
- specifies whether print preview dialog should start in two page display mode
(default true)public boolean isPrintPreviewTwoPageDisplay()
public boolean isCurrentPrintPreviewTwoPageDisplay()
public void setPrintPreviewPageSetupDialog(java.awt.Dialog dialog)
dialog
- Dialog modal dialog to display when user hits "Page Setup" in print preview dialog,
use value null to get the standard Java page setup dialog (i.e., use J2Printer.showPageSetupDialog()) (default: null)public java.awt.Dialog getPrintPreviewPageSetupDialog()
public void setPrintPreviewCloseOnPrint(int closeOnPrint)
closeOnPrint
- int used to specify what happens to the print preview dialog when the user hits
the print preview dialog "Print" button. Possibles values are:
J2Printer.BEFORE to close print preview dialog immediately when user hits "Print" button (works
better on some systems, e.g. Solaris),
J2Printer.WAIT(default) to close print preview dialog after the print dialog appears and the user hits "OK"
(or after printing begins if not using a print dialog),
J2Printer.NEVER to not close print preview dialog until user manually closes the print preview dialog.public int getPrintPreviewCloseOnPrint()
public void setStartingPageNumber(int startingPageNumber)
startingPageNumber
- number used to number the first page of the document (default: 1)public int getStartingPageNumber()
public void setNup(int nup)
nup
- value where N=1, 2, 4, 6, 9, or 16, or minus these same values, where the minus sign
means suppress the drawing of the page outlines. All other values are treated as N=1 (default: 1)public int getNup()
public void setHeaderFont(java.awt.Font font)
font
- Font used for printing headers.
Default: Serif, PLAIN, 10public java.awt.Font getHeaderFont()
public void setHeaderFont(int which, java.awt.Font font)
which
- J2Printer.FIRST (1) if page 1, or J2Printer.REST (0) if pages 2...n.font
- Font used for printing headers.
Default: Serif, PLAIN, 10public java.awt.Font getHeaderFont(int which)
which
- J2Printer.FIRST (1) if page 1, or J2Printer.REST (0) if pages 2...n.
Default: Serif, PLAIN, 10public void setFooterFont(java.awt.Font font)
font
- Font used for printing headers.
Default: Serif, PLAIN, 10public java.awt.Font getFooterFont()
public void setFooterFont(int which, java.awt.Font font)
which
- J2Printer.FIRST (1) if page 1, or J2Printer.REST (0) if pages 2...n.font
- Font used for printing footers.
Default: Serif, PLAIN, 10public java.awt.Font getFooterFont(int which)
which
- J2Printer.FIRST (1) if page 1, or J2Printer.REST (0) if pages 2...n.public void setLeftFooter(java.lang.Object leftFooter)
leftFooter
- String or JLabel representing the leftFooter (if null, use locale-specific date)
Used when Pageable instance value is null.
All occurrences of ### (3 pound signs) replaced by current page number.
All occurrences of @@@ (3 at signs) replaced by total number of pages.
All strings between pairs of |||
(3 vertical bars) passed to Java SimpleDateFormat class and used to format the current date & time.
Default: locale-specific dateSimpleDateFormat
public java.lang.Object getLeftFooter()
public void setLeftFooter(int which, java.lang.Object leftFooter)
which
- J2Printer.FIRST (1) if page 1, or J2Printer.REST (0) if pages 2...n.leftFooter
- String or JLabel representing the leftFooter (if null, use locale-specific date)
Used when Pageable instance value is null.
Page number and data & time formatting same as for setLeftFooter.
Default: locale-specific datesetLeftFooter(java.lang.Object)
public java.lang.Object getLeftFooter(int which)
which
- J2Printer.FIRST (1) if page 1, or J2Printer.REST (0) if pages 2...n.public void setCenterFooter(java.lang.Object centerFooter)
centerFooter
- String or JLabel representing the centerFooter (if null, use locale-specific
page number). Used when Pageable instance value is null.
Page number and data & time formatting same as for setLeftFooter. Default: locale-specific page numbersetLeftFooter(java.lang.Object)
public java.lang.Object getCenterFooter()
public void setCenterFooter(int which, java.lang.Object centerFooter)
which
- J2Printer.FIRST (1) if page 1, or J2Printer.REST (0) if pages 2...n.centerFooter
- String or JLabel representing the centerFooter (if null, use locale-specific
page number). Used when Pageable instance value is null.
Page number and data & time formatting same as for setLeftFooter.
Default: locale-specific page numbersetLeftFooter(java.lang.Object)
public java.lang.Object getCenterFooter(int which)
which
- J2Printer.FIRST (1) if page 1, or J2Printer.REST (0) if pages 2...n.public void setRightFooter(java.lang.Object rightFooter)
rightFooter
- String or JLabel representing the rightFooter (if null, use locale-specific time).
Used when Pageable instance value is null.
Page number and data & time formatting same as for setLeftFooter. Default: local-specific timesetLeftFooter(java.lang.Object)
public java.lang.Object getRightFooter()
public void setRightFooter(int which, java.lang.Object rightFooter)
which
- J2Printer.FIRST (1) if page 1, or J2Printer.REST (0) if pages 2...n.rightFooter
- String or JLabel representing the rightFooter (if null, use locale-specific time).
Used when Pageable instance value is null.
Page number and data & time formatting same as for setLeftFooter.
Default: locale-specific timesetLeftFooter(java.lang.Object)
public java.lang.Object getRightFooter(int which)
which
- J2Printer.FIRST (1) if page 1, or J2Printer.REST (0) if pages 2...n.public void setLeftHeader(java.lang.Object leftHeader)
leftHeader
- String or JLabel representing the leftHeader
Used when Pageable instance value is null.
All occurrences of ### (3 pound signs) replaced by current page number.
All occurrences of @@@ (3 at signs) replaced by total number of pages.
All strings between pairs of |||
(3 vertical bars) passed to Java SimpleDateFormat class and used to format the current date & time.
Default: Wildcrest Associates copyright noticeSimpleDateFormat
public java.lang.Object getLeftHeader()
public void setLeftHeader(int which, java.lang.Object leftHeader)
which
- J2Printer.FIRST (1) if page 1, or J2Printer.REST (0) if pages 2...n.leftHeader
- String or JLabel representing the leftHeader.
Used when Pageable instance value is null.
Page number and data & time formatting same as for setLeftHeader.
Default: Wildcrest Associates copyright noticesetLeftHeader(java.lang.Object)
public java.lang.Object getLeftHeader(int which)
which
- J2Printer.FIRST (1) if page 1, or J2Printer.REST (0) if pages 2...n.public void setCenterHeader(java.lang.Object centerHeader)
centerHeader
- String or JLabel representing the centerHeader.
Used when Pageable instance value is null.
Page number and data & time formatting same as for setLeftHeader. Default: empty StringsetLeftHeader(java.lang.Object)
public java.lang.Object getCenterHeader()
public void setCenterHeader(int which, java.lang.Object centerHeader)
which
- J2Printer.FIRST (1) if page 1, or J2Printer.REST (0) if pages 2...n.centerHeader
- String or JLabel representing the centerHeader.
Used when Pageable instance value is null.
Page number and data & time formatting same as for setLeftHeader.
Default: empty StringsetLeftHeader(java.lang.Object)
public java.lang.Object getCenterHeader(int which)
which
- int = J2Printer.FIRST (1) if page 1, or = .REST (0) if pages 2...n.public void setRightHeader(java.lang.Object rightHeader)
rightHeader
- String or JLabel representing the rightHeader.
Used when Pageable instance value is null.
Page number and data & time formatting same as for setLeftHeader.
Default: Wildcrest Associates copyright noticesetLeftHeader(java.lang.Object)
public java.lang.Object getRightHeader()
public void setRightHeader(int which, java.lang.Object rightHeader)
which
- J2Printer.FIRST (1) if page 1, or J2Printer.REST (0) if pages 2...n.rightHeader
- String or JLabel representing the rightHeader.
Used when Pageable instance value is null.
Page number and data & time formatting same as for setLeftHeader.
Default: Wildcrest Associates copyright noticesetLeftHeader(java.lang.Object)
public java.lang.Object getRightHeader(int which)
which
- J2Printer.FIRST (1) if page 1, or J2Printer.REST (0) if pages 2...n.public void setHeaderStyle(int style)
style
- J2Printer.BOX or .LINE or .NONE.
Used when Pageable instance value is negative (e.g., GLOBAL).
Default: BOXpublic int getHeaderStyle()
public void setHeaderStyle(int which, int style)
which
- J2Printer.FIRST (1) if page 1, or J2Printer.REST (0) if pages 2...n.style
- J2Printer.BOX or .LINE or .NONE.
Used when Pageable instance value is negative (e.g., GLOBAL).
Default: BOXpublic int getHeaderStyle(int which)
which
- J2Printer.FIRST (1) if page 1, or J2Printer.REST (0) if pages 2...n.public void setFooterStyle(int style)
style
- J2Printer.BOX or .LINE or .NONE.
Used when Pageable instance value is negative (e.g., GLOBAL).
Default: BOXpublic int getFooterStyle()
public void setFooterStyle(int which, int style)
which
- J2Printer.FIRST (1) if page 1, or J2Printer.REST (0) if pages 2...n.style
- J2Printer.BOX or .LINE or .NONE.
Used when Pageable instance value is negative (e.g., GLOBAL).
Default: BOXpublic int getFooterStyle(int which)
which
- J2Printer.FIRST (1) if page 1, or REST (0) if pages 2...n.public void clearHeaders()
public void clearHeaders(int which)
which
- int = FIRST (1) if page 1, or = REST (0) if pages 2...n.public void clearFooters()
public void clearFooters(int which)
which
- int = FIRST (1) if page 1, or = REST (0) if pages 2...n.public void setLeftMargin(double leftMargin)
leftMargin
- double representing left margin in inches.
Used when Pageable instance value is negative (e.g., GLOBAL).
Default: 0.0public double getLeftMargin()
public void setRightMargin(double rightMargin)
rightMargin
- double representing right margin in inches.
Used when Pageable instance value is negative (e.g., GLOBAL).
Default: 0.0public double getRightMargin()
public void setTopMargin(double topMargin)
topMargin
- double representing top margin above header in inches.
Used when Pageable instance value is negative (e.g., GLOBAL).
Default: 0.0public double getTopMargin()
public void setBottomMargin(double bottomMargin)
bottomMargin
- double representing bottom margin below footer in inches.
Used when Pageable instance value is negative (e.g., GLOBAL).
Default: 0.0public double getBottomMargin()
public void setGapBelowHeader(double gapBelowHeader)
gapBelowHeader
- double representing gap between the header and first line of body.
Used when Pageable instance value is negative (e.g., GLOBAL).
Default 0.125public double getGapBelowHeader()
public void setGapAboveFooter(double gapAboveFooter)
gapAboveFooter
- double representing gap between the last line of body and the footer in inches.
Used when Pageable instance value is negative (e.g., GLOBAL).
Default 0.125public double getGapAboveFooter()
public void setScale(double scale)
scale
- double scaling factor for printing. Default: 1.0public double getScale()
public void setOrientation(int orientation)
orientation
- J2Printer.PORTRAIT or .LANDSCAPE or .REVERSE_LANDSCAPE
used when Pageable instance value is negative (e.g., GLOBAL).
(same as PageFormat.PORTRAIT, etc.). Default: PORTRAITpublic int getOrientation()
public void setPaperSize(double paperW, double paperH)
paperW
- paper width in 1/72nds of an inch ("points") when viewed in PORTRAITpaperH
- paper height in 1/72nds of an inch ("points") when viewed in PORTRAITpublic double getPaperWidth()
public double getPaperHeight()
public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
protected void fire(java.lang.String propertyName)
public static java.lang.String getVersion()
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |