title: translate method in Graphics
body: <p>I cam across this recently : <a href="http://download.oracle.com/javase/tutorial/2d/printing/examples/HelloWorldPrinter.java" rel="nofollow">here</a></p>
  
  <pre><code> public int print(Graphics g, PageFormat pf, int page) throws
                                                      PrinterException {
  
      if (page &gt; 0) { /* We have only one page, and 'page' is zero-based */
          return NO_SUCH_PAGE;
      }
  
      /* User (0,0) is typically outside the imageable area, so we must
       * translate by the X and Y values in the PageFormat to avoid clipping
       */
      Graphics2D g2d = (Graphics2D)g;
      g2d.translate(pf.getImageableX(), pf.getImageableY()); // line 2
  
      g.drawString("Hello world!", 100, 100);
  
      /* tell the caller that this page is part of the printed document */
      return PAGE_EXISTS;
  }
  </code></pre>
  
  <p>I don't understand the line 2 <em>(commented)</em> in this snippet.<em><code>(g2d.translate(pf.getImageableX(), pf.getImageableY());)</code></em>   g2d is a reference of <code>Graphics2d</code>and <code>translate</code> is a method found in Graphic class. Then how does it work ?</p>