15.5. Swing Component Printing
The Java 2 Platform supports high-quality printing through classes in the java.awt.print package. This section describes how to use this printing package to print Swing components. In a sense, printing is little more than painting the component on the Graphics2D object and rendering the graphics on the printer. When printing in JDK 1.2, you must first globally turn off double buffering before painting the component. In JDK 1.3, the printing model changed and a print method was added to the JComponent class to automatically take care of double buffering. In the following sections, we look at the basics of printing and explain the importance of disabling double buffering before printing in JDK 1.2. Then, we illustrate ...
Get Core Web Programming, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.