Code Sample: Printable Stylepad

This Code Sample adds a print capability to the Stylepad application (The Stylepad application is included among the Demo applications provided as part of the Java SDK.) The Stylepad application uses a javax.swing.JTextPane  to implement a styled text editor which contains an excerpt from the children's classic  Alice In Wonderland  by Lewis Carrol. This application can be found in the /demo/jfc/Stylepad  subdirectory of the directory in which the SDK is installed (assuming that the Demo Applications were installed). (NOTE: The entire Stylepad SDK Sample application is included in the Stylepad.jar file, so you do not need to install the SDK Demo Code to run this Code Sample.)

The print capability added to the Stylepad application consists of JPDF Page Setup, Print Preview, and Print dialogs. These dialogs are accessed using new menu items in the File Menu.

This example is implemented using a single class: PrintableStylepad. The preexisting Stylepad Demo application is contained in the Stylepad.jar file.

This application must be run using JRE version 1.5. Version 1.5 is required because of the way in which the Stylepad Demo application was compiled.