Huge Collections of Software Manuals and Knowledgebase

GreatManuals.com
Huge Collections of Software Manuals and Knowledgebase

 
Home Contact us Request to publish your help manuals Request to remove your help manuals Buy Now
Introduction
» J2PrinterWorks
» Print Samples and Screen Shots
» Sample Programs and Sample Code
» Installing and Uninstalling
» Pageable and Flowable
Using J2PrinterWorks
» J2Printer
» J2Printer14
» J2PrinterWebStart
» J2TextPrinter
» J2TablePrinter
» J2TreePrinter
» J2ListPrinter
» J2PanelPrinter
» J2ComponentPrinter
» J2FlowPrinter
» Working with HTML
» Utility Classes
» Converting from 1.x
» Class Diagram
» Removed Methods
Support Details
» Known Problems and Bug Reporting
» Frequently Asked Questions
» Technical Support
 
Buy J2PrinterWorks Online! Buy J2PrinterWorks Online!

J2TablePrinter

Overview

J2TablePrinter is a Java 2 component for printing multi-page JTable documents. J2TablePrinter converts any JTable or JTable subclass into a Java Pageable, suitable for printing by the J2Printer class (or any Java PrinterJob). It also implements Flowable for any JTable, so that it may be used with J2FlowPrinter as part of a series of Flowables printed back-to-back.

J2TablePrinter Pagination

J2TablePrinter paginates over multiple pages both horizontally and vertically. Beginning the J2PrinterWorks 4.0 there are now three different pagination rules supported by J2TablePrinter, which may be specified independently in the horizontal and vertical directions. The available pagination rules are:

picture unerase photos recovery thumb drive undelete
flash drive undelete unformat usb drive recover usb drive files
best data recovery software data recovery utilities downloads send group sms
  • BREAK_ON_ROWS and BREAK_ON_COLUMNS - These are the default pagination rules and the only method available in previous versions of J2PrinterWorks. Under these rules, J2TablePrinter calculates all the table row heights and column widths and uses these to find the maximum number of rows and/or columns that fit on each page. Rows and columns can be of variable height and width.
  • SHRINK_TO_FIT - This pagination rule allows you to force rescaling of the JTable down in size as necessary to fit the available page width and/or height. Since horizontal and vertical pagination rules are independent, you can use SHRINK_TO_FIT horizontally to shrink your JTable to one page wide, andpagination using BREAK_ON_ROWS to paginate over multiple pages vertically, breaking on JTable row boundaries. NOTE: It is strongly recommended that you use this method to scale your JTable to, for example, one page wide rather than the previous setMaximumPages(1,0) technique, since the setMaximumPages technique is a slow iterative process and not updated when any table or page size parameters change, whereas SHRINK_TO_FIT is a direct calculation and is maintained as a state in the presence of size changes.
  • BREAK_ON_COLOR - This pagination rule allows you to break your JTable based on searching the JTable image for the closest match to a specified color. The default break color is the JTable gridline color. This rule is useful for complex situations such as nested JTables, which will correctly break on subtable row and column boundaries as detected by gridline color matching, whereas BREAK_ON_ROWS and BREAK_ON_COLUMNS are only able to break on top-level row and column boudaries. NOTE: The image color analsysis underlying BREAK_ON_COLOR mode can be slow for large JTable instances. See the methods setAutomaticRecalculation(boolean) and breakOnColorIncrement(int) for ways to optimize these calculations.

J2PrinterWorks pagination proceeds in "raster" order, i.e., left-to-right across multiple pages horizontally, then top-to-bottom over multiple pages vertically. When paginating, J2TablePrinter may split large rows and/or columns across page boundaries depending upon how much space remains on the page. In making this determination, J2TablePrinter first reads the value of getMaximumPaginationGap(), default is 0.2 or 20%. If the remaining space on the page horizontally is less than getMaximumPaginationGap() percent of the full page width, then the printing of the next column skips to the next page horizontally. Otherwise, the column is split at the exact pixel boundary that fits the remaining space on the page, with the remainder of the column continuing on the next page horizontally. Likewise, if the remaining space on the page vertically is less than getMaximumPaginationGap() percent of the full page height, then the printing of the next row skips to the next page vertically. Otherwise the row is split at the exact pixel boundary that fits the remaining space on the page, with the remainder of the row continuing on the next page vertically. Thus, in both cases, getMaximumPaginationGap() defines the largest fraction of a page width or height that it is OK to waste in order to keep columns and/or rows intact.

Column headers can appear on all pages, only the top pages, or not at all. Row headers can appear on all pages, only the left pages, or not at all. The JTable can be left, right, or center justified horizontally, and top, bottom, or center justified vertically. You can also control whether the gridlines and outside lines are printed. J2TablePrinter prints the JTable "WYSIWYG", so that any background colors, fonts, or custom cell renderers will be printed.

Programming

You will find it useful to begin your program with:

import com.wildcrest.j2printerworks.*;

rather than spell out the full package name for all J2PrinterWorks classes.

J2TablePrinter can instantiated with a zero-argument constructor:

J2TablePrinter tablePrinter = new J2TablePrinter();

This creates a J2TablePrinter object and initializes all values to their defaults (see the J2TablePrinter Javadoc documentation ). To specify the JTable to be printed by J2TablePrinter, you can use the J2TablePrinter method setTable:
tablePrinter.setTable(yourJTable);
At this point tablePrinter is a Pageable suitable for printing by J2Printer.

Alternatively, you can use the single-argument J2TablePrinter constructor:
J2TablePrinter tablePrinter = new J2TablePrinter(yourJTable);

The following is a simple but complete Java program (J2TablePrinterSimplestTest.java ) that displays and prints a JTable using J2TextPrinter:

»

Buy J2PrinterWorks Online! Buy J2PrinterWorks Online!
Home | Contact Us | Request to publish your help manuals | Request to remove your help manuals