876 877 } catch (PrinterException e) { 878 879 } 880 881 boolean ret = printDialog(); 882 this.attributes = attributes; 883 return ret; 884 885 } 886 887 /* A security check has already been performed in the 888 * java.awt.print.printerJob.getPrinterJob method. 889 * So by the time we get here, it is OK for the current thread 890 * to print either to a file (from a Dialog we control!) or 891 * to a chosen printer. 892 * 893 * We raise privilege when we put up the dialog, to avoid 894 * the "warning applet window" banner. 895 */ 896 final GraphicsConfiguration gc = 897 GraphicsEnvironment.getLocalGraphicsEnvironment(). 898 getDefaultScreenDevice().getDefaultConfiguration(); 899 900 PrintService service = java.security.AccessController.doPrivileged( 901 new java.security.PrivilegedAction<PrintService>() { 902 public PrintService run() { 903 PrintService service = getPrintService(); 904 if (service == null) { 905 ServiceDialog.showNoPrintService(gc); 906 return null; 907 } 908 return service; 909 } 910 }); 911 912 if (service == null) { 913 return false; 914 } 915 916 PrintService[] services; 917 StreamPrintServiceFactory[] spsFactories = null; 918 if (service instanceof StreamPrintService) { | 876 877 } catch (PrinterException e) { 878 879 } 880 881 boolean ret = printDialog(); 882 this.attributes = attributes; 883 return ret; 884 885 } 886 887 /* A security check has already been performed in the 888 * java.awt.print.printerJob.getPrinterJob method. 889 * So by the time we get here, it is OK for the current thread 890 * to print either to a file (from a Dialog we control!) or 891 * to a chosen printer. 892 * 893 * We raise privilege when we put up the dialog, to avoid 894 * the "warning applet window" banner. 895 */ 896 GraphicsConfiguration grCfg = null; 897 Window w = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(); 898 if (w != null) { 899 grCfg = w.getGraphicsConfiguration(); 900 } else { 901 grCfg = GraphicsEnvironment.getLocalGraphicsEnvironment(). 902 getDefaultScreenDevice().getDefaultConfiguration(); 903 } 904 final GraphicsConfiguration gc = grCfg; 905 906 PrintService service = java.security.AccessController.doPrivileged( 907 new java.security.PrivilegedAction<PrintService>() { 908 public PrintService run() { 909 PrintService service = getPrintService(); 910 if (service == null) { 911 ServiceDialog.showNoPrintService(gc); 912 return null; 913 } 914 return service; 915 } 916 }); 917 918 if (service == null) { 919 return false; 920 } 921 922 PrintService[] services; 923 StreamPrintServiceFactory[] spsFactories = null; 924 if (service instanceof StreamPrintService) { |