< prev index next >

src/java.desktop/windows/native/libawt/windows/awt_PrintControl.cpp

Print this page

        

@@ -768,30 +768,30 @@
                                           AwtPrintControl::getToPageID);
     pd.nMinPage = (WORD)env->CallIntMethod(printCtrl,
                                            AwtPrintControl::getMinPageID);
     jint maxPage = env->CallIntMethod(printCtrl,
                                       AwtPrintControl::getMaxPageID);
+    jint selectType = env->CallIntMethod(printCtrl,
+                                         AwtPrintControl::getSelectID);
     pd.nMaxPage = (maxPage <= (jint)((WORD)-1)) ? (WORD)maxPage : (WORD)-1;
     // In the event that the application displays the dialog before
     // installing a Printable, but sets a page range, then max page will be 1
     // since the default state of a PrinterJob is an empty "Book" Pageable.
     // Windows pops up an error dialog in such a case which isn't very
     // forthcoming about the exact problem.
     // So if we detect this fix up such a problem here.
     if (pd.nMinPage > pd.nFromPage) pd.nMinPage = pd.nFromPage;
     if (pd.nMaxPage < pd.nToPage) pd.nMaxPage = pd.nToPage;
-    if (pd.nFromPage > pd.nMinPage || pd.nToPage < pd.nMaxPage) {
+    if (selectType != 0 && (pd.nFromPage > pd.nMinPage || pd.nToPage < pd.nMaxPage)) {
       pd.Flags |= PD_PAGENUMS;
     }
 
     if (env->CallBooleanMethod(printCtrl,
                                AwtPrintControl::getDestID)) {
       pd.Flags |= PD_PRINTTOFILE;
     }
 
-    jint selectType = env->CallIntMethod(printCtrl,
-                                         AwtPrintControl::getSelectID);
 
     // selectType identifies whether No selection (2D) or
     // SunPageSelection (AWT)
     if (selectType != 0) {
       pd.Flags |= selectType;
< prev index next >