Java Reference
In-Depth Information
width of 20 and a height of 10, that is what it will always be, unless you change the object. You always print
it at position (5,5). If you want this object to appear at the top-left corner of the paper then the coordinates
of the top-left corner of the paper must be (5,5).
Now consider our sketch. The point ( rect.x , rect.y ) is the top-left corner of the rectangle bounding
our sketch, the area you want to transfer to the page, and this point is fixed — you can't change it. With the
current paper coordinates at the top-left corner of the printable area, it might print something like that shown
in Figure 21-9 .
FIGURE 21-9
When you print a sketch you really want the point ( rect.x , rect.y ) to end up at the top-left corner of
the printable area on the page. In other words, you have to move the origin of the coordinate system for the
paper so that the point ( rect.x , rect.y ) in the new coordinate system is the top-left corner of the printable
area. To do this you must move the origin to the new position shown in Figure 21-10 .
FIGURE 21-10
 
 
 
 
Search WWH ::




Custom Search