O'Reilly logo

Ivor Horton's Beginning Java™ 2, JDK™ 5th Edition by Ivor Horton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required