title: java.awt.print only prints the first page
body: <p>i m trying to print a list according to the print example in oracle's web page and for some reason it would only print the first page of the list  </p>
  
  <p>i took the printing sample from oracle about basic printing :
  <a href="http://docs.oracle.com/javase/tutorial/2d/printing/printable.html" rel="nofollow">A Basic Printing Program</a></p>
  
  <p>and modified it here to explain what i mean a little bit better </p>
  
  <pre><code>import java.awt.*;
  import java.awt.event.*;
  import javax.swing.*;
  import java.awt.print.*;
  
  public class HelloWorldPrinter implements Printable, ActionListener {
  
  
      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;
          }
  
          Graphics2D g2d = (Graphics2D)g;
          g2d.translate(pf.getImageableX(), pf.getImageableY());
  
          g.drawString("1.Hello world!", 100, 100);
          g.drawString("2.Hello world!", 100, 300);
          g.drawString("3.Hello world!", 100, 600);
          g.drawString("4.Hello world!", 100, 800);
          g.drawString("5.Hello world!", 100, 1000);
          g.drawString("6.Hello world!", 100, 1200);
          g.drawString("7.Hello world!", 100, 1500);
  
          return PAGE_EXISTS;
      }
  
      public void actionPerformed(ActionEvent e) {
           PrinterJob job = PrinterJob.getPrinterJob();
           job.setPrintable(this);
           boolean ok = job.printDialog();
           if (ok) {
               try {
                    job.print();
               } catch (PrinterException ex) {
               }
           }
      }
  
      public static void main(String args[]) {
  
          UIManager.put("swing.boldMetal", Boolean.FALSE);
          JFrame f = new JFrame("Hello World Printer");
          f.addWindowListener(new WindowAdapter() {
             public void windowClosing(WindowEvent e) {System.exit(0);}
          });
          JButton printButton = new JButton("Print Hello World");
          printButton.addActionListener(new HelloWorldPrinter());
          f.add("Center", printButton);
          f.pack();
          f.setVisible(true);
      }
  }
  </code></pre>
  
  <p>this example would only print the first 4 lines ...</p>