Chapter 21. Filing and Printing Documents
In this chapter you'll explore serializing and printing documents in an application and adding these as the finishing touches to the Sketcher program. These capabilities are not available to an untrusted applet for security reasons, so everything I'll cover here applies only to applications and trusted applets. Although you have already covered serialization in Chapter 12, you'll find that there is quite a difference between understanding how the basic methods for object input and output work and applying them in a practical context.
In this chapter you'll learn:
How to use the JFileChooser class
How to save a sketch in a file as objects
How to implement the Save As menu mechanism
How to open a sketch stored in a file and integrate it into the application
How to create a new sketch and integrate it into the application
How to ensure that the current sketch is saved before the application is closed or a new sketch is loaded
How printing in Java works
How to print in landscape orientation rather than portrait orientation
How to implement multipage printing
How to output components to your printer
Get Ivor Horton's Beginning Java™ 2, JDK™ 5th 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.