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

java.awt.JobAttributes.getFromPage() and getToPage() always returns "1".

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 5.0
    • Fix Version/s: 9
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
      2d
    • Resolved In Build:
      b116
    • CPU:
      x86
    • OS:
      windows_xp

      Description

      FULL PRODUCT VERSION :
      java version "1.5.0_06"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
      Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)

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

      A DESCRIPTION OF THE PROBLEM :
      In the Print-dialog, when some pages are specified using "Pages" within "Page range", java.awt.JobAttributes.getFromPage() and getToPage() always returns "1".
      This Problem occurs only in JRE1.5.0_05, and never happens in JRE 1.4.2_10.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1.Run the following source code.
      2.[File]menu, select [Print].
      3.Specify pusing "Pages" within "Page range" in Print-dialog.
        example: "from"=2, "to"=2
      4.Print.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
       java.awt.JobAttributes.getFromPage() and getToPage() returns correct value.
      ACTUAL -
       java.awt.JobAttributes.getFromPage() and getToPage() always returns "1".

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.*;
      import java.awt.event.*;

      public class PrintJobTest03 extends Frame {

          public static void main(String[] args) {
              Frame f = new PrintJobTest03();
              f.setSize(200, 100);
              f.show();
          }

          public PrintJobTest03() {
              MenuBar mb = new MenuBar();
              Menu m = new Menu("File");
              MenuItem mi = new MenuItem("Print");
              mi.addActionListener(new ActionListener() {
                  public void actionPerformed(ActionEvent evt) {
                      executePrintJob();
                  }
              });

              m.add(mi);
              mb.add(m);
              setMenuBar(mb);

              addWindowListener(new WindowAdapter() {
                  public void windowClosing(WindowEvent e) {
                      System.exit(0);
                  }
              });
          }

          public void executePrintJob() {

              JobAttributes ja = new JobAttributes();

              // show dialog
              PrintJob pjob = getToolkit().getPrintJob(this, "test", ja, null);
              if (pjob == null)
                  return;

              if (ja.getDefaultSelection() == JobAttributes.DefaultSelectionType.RANGE) {
                  int fromP = ja.getFromPage();
                  int toP = ja.getToPage();
                  System.out.println("JobAttributes#getFromPage() " + fromP);
                  System.out.println("JobAttributes#getToPage() " + toP);
              }
          }
      }

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

        Attachments

          Activity

            People

            Assignee:
            psadhukhan Prasanta Sadhukhan
            Reporter:
            prr Philip Race
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: