|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.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), print request attributes (1.4), cross-platform dialogs (1.4), and print to Postscript (1.4).
Programs using the J2Printer class can build and run on JDK 1.2, 1.3, and 1.4.
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 2007, 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 |
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 |
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 |
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). |
protected void |
fire(java.lang.String propertyName)
|
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)
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)
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. |
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 |
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 |
isPrintPreviewCloseOnPrint()
Deprecated. Use getPrintPreviewCloseOnPrint()!=J2Printer.NEVER |
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)
Deprecated. Use printToHTML(dir, file, scale, true) |
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. |
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(boolean closeOnPrint)
Deprecated. Use setPrintPreviewCloseOnPrint(J2Printer.WAIT) for true or
setPrintPreviewCloseOnPrint(J2Printer.NEVER) for false |
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 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 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 image
public 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)
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,