< prev index next >

src/java.desktop/share/classes/sun/print/RasterPrinterJob.java

Print this page

        

@@ -764,12 +764,19 @@
             (DialogTypeSelection)attributes.get(DialogTypeSelection.class);
 
         // Check for native, note that default dialog is COMMON.
         if (dlg == DialogTypeSelection.NATIVE) {
             PrintService pservice = getPrintService();
-            PageFormat page = pageDialog(attributeToPageFormat(pservice,
-                                                               attributes));
+            PageFormat pageFrmAttrib = attributeToPageFormat(pservice, 
+                                                             attributes);
+            PageFormat page = pageDialog(pageFrmAttrib);
+            
+            // If user cancels the dialog, pageDialog() will return the original
+            // page object and as per spec, we should return null in that case.
+            if (page.equals(pageFrmAttrib)) {
+                return null;
+            }
             updateAttributesWithPageFormat(pservice, page, attributes);
             return page;
         }
 
         final GraphicsConfiguration gc =
< prev index next >