title: choosing document to be printed by PrinterJob.getPrinterJob().print
body: <p>This code snippet is given as an example for using a print dialog in oracle java tutorials:</p>
  
  <pre><code>PrinterJob pj = PrinterJob.getPrinterJob();
      if (pj.printDialog())
      {
          try {
              pj.print();
              }
          catch (PrinterException exc) {
              System.out.println(exc);
           }
       } 
  </code></pre>
  
  <p>I didn't understand where is the process of selecting what to print happening? Where should I specify which document is to be printed?</p>