Printing Support in Swing Components
by , 03-07-2012 at 05:53 PM (662 Views)
Contents out of view or which are invisible because of scrolling in a scrollable window would not be present in a printout. At printer, they will be placing a dumb effect. This specified problem is usually present with larger components printing like a swing table or text components.
Multiple lines of text are present in many components that are entirely not visible at the screen. Contents shall be printed in a way that is consistent along with the screen display.
For sorting out such problems, swing tables are text components are aware of printing. For Java 2D printing, these given methods would be used.
- javax.swing.text.JTextComponent.print();
- javax.swing.JTable.print();
Implementations of the contents that are required to be printed are supported by the above methods. Printable interface is implemented by an application and PrinterJob object creation is not needed.
When you call these methods, print dialog gets displayed. According to the selection of user, component data will be printed.









Email Blog Entry
Size Reduced for Images in PDF &...
05-15-2013, 05:53 PM in Java Software