Java Reference
In-Depth Information
Filing and Printing Documents
In this chapter we will explore serializing and printing documents in an application, and adding these as
the finishing touches to our Sketcher program. These capabilities are not available to an untrusted
applet for security reasons, so everything we will cover here only applies to applications and trusted
applets. Although we have already covered serialization in Chapter 11, you will 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 will 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
❑