Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6529030

Java Printing: Print range > Selection gets enabled

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 6
    • client-libs
    • 2d
    • b124
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.6.0"
      Java(TM) SE Runtime Environment (build 1.6.0-b105)
      Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Printer driver: hp LaserJet 1300 PCL 6 (60.5.17.2)

      A DESCRIPTION OF THE PROBLEM :
      When using java.awt.print.PrinterJob instance more then once, Print range > Selection in Print dialog gets enabled after first use.

      However Print range > Selection is disabled at first time.

      REGRESSION. Last worked in version mustang

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Run example below
      2. Chose printer
      3. Press OK
      4. On second Print dialog you will be able to chose "Print range > Selection" option

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      "Print range > Selection" option is disabled
      ACTUAL -
      "Print range > Selection" option is enabled

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.Graphics;
      import java.awt.print.Printable;
      import java.awt.print.PageFormat;
      import java.awt.print.PrinterException;
      import java.awt.print.PrinterJob;

      public class T {

      static PrinterJob printJob;

      public static void print() {

      // Set working printable to print pages
      printJob.setPrintable(new Printable() {
      public int print(Graphics graphics, PageFormat pageFormat,
      int pageIndex) throws PrinterException {
      pageIndex++;
      if (pageIndex < 10) {
      System.out.println("Printing page: " + pageIndex);
      graphics.drawString("Page #" + pageIndex + " of 9",
      (int) pageFormat.getImageableX() + 5,
      (int) pageFormat.getImageableY() + 20);
      graphics.dispose();
      return PAGE_EXISTS;
      } else {
      return NO_SUCH_PAGE;
      }
      }
      });

      // Display Print dialog
      if (!printJob.printDialog()) {
      System.out.println("\tPrinting canceled by user");
      return;
      }


      try {
      printJob.print();
      } catch (PrinterException e) {
      }
      }

      public static void main(String[] args) {
      printJob = PrinterJob.getPrinterJob();
      System.out.println(" -=- Starting printing #1 -=-");
      print();
      System.out.println(" -=- Starting printing #2 -=-");
      print();
      }
      }

      ---------- END SOURCE ----------

            psadhukhan Prasanta Sadhukhan
            igor Igor Nekrestyanov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: