Java Reference
In-Depth Information
FIGURE 21-7
The picture that I get printed on the paper is incomplete. The flowers and rocks to the right are not in in
view, and that interesting cross between a rabbit and a cat is missing. I was hoping to see the picture in
its full glory.
If you think about it, though, it's very optimistic to believe that you could automatically get the whole
sketch printed. First of all, neither the PrinterJob object nor the view object has any idea how big the
sketch is. That's a fairly fundamental piece of data if you want a complete sketch printed. Another con-
sideration is that the sketch might be wider than it is high, and you are printing in portrait orientation.
Moreover, in general parts of the sketch might be outside the screen area — when you draw a circle with
the center close to the edge of the application window for instance. Let's see how you might deal with
some of these problems.
NOTE Note that material change to the Element subclasses cause problems in re-
trievingoldsketches.Sketchesthatwereserializedbeforethechangesdonotdeseri-
alize afterward, because the class definition you use to read the data is different
from the class definition when you wrote it. You should always change the value of
serialVersionUID when you change the class definition.
Printing the Whole Sketch
 
Search WWH ::




Custom Search