src/share/classes/javax/print/ServiceUI.java

Print this page




 101      * <p>
 102      * An application may optionally pass in the flavor to be printed.
 103      * If this is non-null choices presented to the user can be better
 104      * validated against those supported by the services.
 105      * An application must pass in a PrintRequestAttributeSet for returning
 106      * user choices.
 107      * On calling the PrintRequestAttributeSet may be empty, or may contain
 108      * application-specified values.
 109      * <p>
 110      * These are used to set the initial settings for the initially
 111      * displayed print service. Values which are not supported by the print
 112      * service are ignored. As the user browses print services, attributes
 113      * and values are copied to the new display. If a user browses a
 114      * print service which does not support a particular attribute-value, the
 115      * default for that service is used as the new value to be copied.
 116      * <p>
 117      * If the user cancels the dialog, the returned attributes will not reflect
 118      * any changes made by the user.
 119      *
 120      * A typical basic usage of this method may be :
 121      * <pre>
 122      * PrintService[] services = PrintServiceLookup.lookupPrintServices(
 123      *                            DocFlavor.INPUT_STREAM.JPEG, null);
 124      * PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
 125      * if (services.length > 0) {
 126      *    PrintService service =  ServiceUI.printDialog(null, 50, 50,
 127      *                                               services, services[0],
 128      *                                               null,
 129      *                                               attributes);
 130      *    if (service != null) {
 131      *     ... print ...
 132      *    }
 133      * }
 134      * </pre>
 135      * <p>
 136 
 137      * @param gc used to select screen. null means primary or default screen.
 138      * @param x location of dialog including border in screen coordinates
 139      * @param y location of dialog including border in screen coordinates
 140      * @param services to be browsable, must be non-null.
 141      * @param defaultService - initial PrintService to display.
 142      * @param flavor - the flavor to be printed, or null.
 143      * @param attributes on input is the initial application supplied
 144      * preferences. This cannot be null but may be empty.
 145      * On output the attributes reflect changes made by the user.
 146      * @return print service selected by the user, or null if the user
 147      * cancelled the dialog.
 148      * @throws HeadlessException if GraphicsEnvironment.isHeadless()
 149      * returns true.
 150      * @throws IllegalArgumentException if services is null or empty,
 151      * or attributes is null, or the initial PrintService is not in the
 152      * list of browsable services.
 153      */
 154     public static PrintService printDialog(GraphicsConfiguration gc,




 101      * <p>
 102      * An application may optionally pass in the flavor to be printed.
 103      * If this is non-null choices presented to the user can be better
 104      * validated against those supported by the services.
 105      * An application must pass in a PrintRequestAttributeSet for returning
 106      * user choices.
 107      * On calling the PrintRequestAttributeSet may be empty, or may contain
 108      * application-specified values.
 109      * <p>
 110      * These are used to set the initial settings for the initially
 111      * displayed print service. Values which are not supported by the print
 112      * service are ignored. As the user browses print services, attributes
 113      * and values are copied to the new display. If a user browses a
 114      * print service which does not support a particular attribute-value, the
 115      * default for that service is used as the new value to be copied.
 116      * <p>
 117      * If the user cancels the dialog, the returned attributes will not reflect
 118      * any changes made by the user.
 119      *
 120      * A typical basic usage of this method may be :
 121      * <pre>{@code
 122      * PrintService[] services = PrintServiceLookup.lookupPrintServices(
 123      *                            DocFlavor.INPUT_STREAM.JPEG, null);
 124      * PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
 125      * if (services.length > 0) {
 126      *    PrintService service =  ServiceUI.printDialog(null, 50, 50,
 127      *                                               services, services[0],
 128      *                                               null,
 129      *                                               attributes);
 130      *    if (service != null) {
 131      *     ... print ...
 132      *    }
 133      * }
 134      * }</pre>
 135      * <p>
 136 
 137      * @param gc used to select screen. null means primary or default screen.
 138      * @param x location of dialog including border in screen coordinates
 139      * @param y location of dialog including border in screen coordinates
 140      * @param services to be browsable, must be non-null.
 141      * @param defaultService - initial PrintService to display.
 142      * @param flavor - the flavor to be printed, or null.
 143      * @param attributes on input is the initial application supplied
 144      * preferences. This cannot be null but may be empty.
 145      * On output the attributes reflect changes made by the user.
 146      * @return print service selected by the user, or null if the user
 147      * cancelled the dialog.
 148      * @throws HeadlessException if GraphicsEnvironment.isHeadless()
 149      * returns true.
 150      * @throws IllegalArgumentException if services is null or empty,
 151      * or attributes is null, or the initial PrintService is not in the
 152      * list of browsable services.
 153      */
 154     public static PrintService printDialog(GraphicsConfiguration gc,