402 /**
403 * Display a dialog to the user allowing the modification of a
404 * PageFormat instance.
405 * The <code>page</code> argument is used to initialize controls
406 * in the page setup dialog.
407 * If the user cancels the dialog, then the method returns the
408 * original <code>page</code> object unmodified.
409 * If the user okays the dialog then the method returns a new
410 * PageFormat object with the indicated changes.
411 * In either case the original <code>page</code> object will
412 * not be modified.
413 * @param page the default PageFormat presented to the user
414 * for modification
415 * @return the original <code>page</code> object if the dialog
416 * is cancelled, or a new PageFormat object containing
417 * the format indicated by the user if the dialog is
418 * acknowledged
419 * @exception HeadlessException if GraphicsEnvironment.isHeadless()
420 * returns true.
421 * @see java.awt.GraphicsEnvironment#isHeadless
422 * @since JDK1.2
423 */
424 @Override
425 public PageFormat pageDialog(PageFormat page) throws HeadlessException {
426 if (GraphicsEnvironment.isHeadless()) {
427 throw new HeadlessException();
428 }
429
430 if (!(getPrintService() instanceof Win32PrintService)) {
431 return super.pageDialog(page);
432 }
433
434 PageFormat pageClone = (PageFormat) page.clone();
435 boolean result = false;
436
437 /*
438 * Fix for 4507585: show the native modal dialog the same way printDialog() does so
439 * that it won't block event dispatching when called on EventDispatchThread.
440 */
441 WPageDialog dialog = new WPageDialog((Frame)null, this,
442 pageClone, null);
|
402 /**
403 * Display a dialog to the user allowing the modification of a
404 * PageFormat instance.
405 * The <code>page</code> argument is used to initialize controls
406 * in the page setup dialog.
407 * If the user cancels the dialog, then the method returns the
408 * original <code>page</code> object unmodified.
409 * If the user okays the dialog then the method returns a new
410 * PageFormat object with the indicated changes.
411 * In either case the original <code>page</code> object will
412 * not be modified.
413 * @param page the default PageFormat presented to the user
414 * for modification
415 * @return the original <code>page</code> object if the dialog
416 * is cancelled, or a new PageFormat object containing
417 * the format indicated by the user if the dialog is
418 * acknowledged
419 * @exception HeadlessException if GraphicsEnvironment.isHeadless()
420 * returns true.
421 * @see java.awt.GraphicsEnvironment#isHeadless
422 * @since 1.2
423 */
424 @Override
425 public PageFormat pageDialog(PageFormat page) throws HeadlessException {
426 if (GraphicsEnvironment.isHeadless()) {
427 throw new HeadlessException();
428 }
429
430 if (!(getPrintService() instanceof Win32PrintService)) {
431 return super.pageDialog(page);
432 }
433
434 PageFormat pageClone = (PageFormat) page.clone();
435 boolean result = false;
436
437 /*
438 * Fix for 4507585: show the native modal dialog the same way printDialog() does so
439 * that it won't block event dispatching when called on EventDispatchThread.
440 */
441 WPageDialog dialog = new WPageDialog((Frame)null, this,
442 pageClone, null);
|