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

PrinterJob not cancelled when PrinterJob.cancel() is used

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.3.0
    • 1.2.1
    • client-libs
    • 2d
    • kestrel
    • x86
    • windows_95



      Name: rlT66838 Date: 06/09/99


      1. While printing a screen using Java2D print(), I intend to
         cancel the Printing by using PrinterJob.cancel().
         But, the Printing job is not being cancelled.

      2. Relevant Portion of SOURCE-CODE :

         PrinterJob job;
         job = PrinterJob.getPrinterJob();
         job.setPrintable(this);
         pf = job.defaultPage();
         pf.setOrientation(PageFormat.LANDSCAPE);

         if (job.printDialog())
         {
      try{
      job.print();
      }
      catch (Exception e)
          {
      JOptionPane.showMessageDialog(this,"exception occured while printing......");
      }
          }

          public int print(Graphics g, PageFormat pf, int pageIndex) throws PrinterException
          {
             if (pageIndex >= 1)
      return Printable.NO_SUCH_PAGE;
      Graphics2D g2 = (Graphics2D) g;
      g2.translate(pf.getImageableX()-55, pf.getImageableY()-10);
      getContentPane().paint(g2);

              return Printable.PAGE_EXISTS;
          }

         //In the Event-Handler of Cancel Button, I am using :

           job.cancel();


      5. Output of "java -version" command :
         java version "1.2.1"
         Classic VM(build JDK-1.2.1-A, native threads)

         Output of "java -fullversion" command :
         JAVA.EXE full version "JDK1.2.1-A"
      (Review ID: 84115)
      ======================================================================

            prr Philip Race
            rlewis Roger Lewis (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: