1 /*
2 * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
114 * default for that service is used as the new value to be copied.
115 * <p>
116 * If the user cancels the dialog, the returned attributes will not reflect
117 * any changes made by the user.
118 *
119 * A typical basic usage of this method may be :
120 * <pre>{@code
121 * PrintService[] services = PrintServiceLookup.lookupPrintServices(
122 * DocFlavor.INPUT_STREAM.JPEG, null);
123 * PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
124 * if (services.length > 0) {
125 * PrintService service = ServiceUI.printDialog(null, 50, 50,
126 * services, services[0],
127 * null,
128 * attributes);
129 * if (service != null) {
130 * ... print ...
131 * }
132 * }
133 * }</pre>
134 * <p>
135
136 * @param gc used to select screen. null means primary or default screen.
137 * @param x location of dialog including border in screen coordinates
138 * @param y location of dialog including border in screen coordinates
139 * @param services to be browsable, must be non-null.
140 * @param defaultService - initial PrintService to display.
141 * @param flavor - the flavor to be printed, or null.
142 * @param attributes on input is the initial application supplied
143 * preferences. This cannot be null but may be empty.
144 * On output the attributes reflect changes made by the user.
145 * @return print service selected by the user, or null if the user
146 * cancelled the dialog.
147 * @throws HeadlessException if GraphicsEnvironment.isHeadless()
148 * returns true.
149 * @throws IllegalArgumentException if services is null or empty,
150 * or attributes is null, or the initial PrintService is not in the
151 * list of browsable services.
152 */
153 public static PrintService printDialog(GraphicsConfiguration gc,
154 int x, int y,
155 PrintService[] services,
|
1 /*
2 * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
114 * default for that service is used as the new value to be copied.
115 * <p>
116 * If the user cancels the dialog, the returned attributes will not reflect
117 * any changes made by the user.
118 *
119 * A typical basic usage of this method may be :
120 * <pre>{@code
121 * PrintService[] services = PrintServiceLookup.lookupPrintServices(
122 * DocFlavor.INPUT_STREAM.JPEG, null);
123 * PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
124 * if (services.length > 0) {
125 * PrintService service = ServiceUI.printDialog(null, 50, 50,
126 * services, services[0],
127 * null,
128 * attributes);
129 * if (service != null) {
130 * ... print ...
131 * }
132 * }
133 * }</pre>
134 *
135 * @param gc used to select screen. null means primary or default screen.
136 * @param x location of dialog including border in screen coordinates
137 * @param y location of dialog including border in screen coordinates
138 * @param services to be browsable, must be non-null.
139 * @param defaultService - initial PrintService to display.
140 * @param flavor - the flavor to be printed, or null.
141 * @param attributes on input is the initial application supplied
142 * preferences. This cannot be null but may be empty.
143 * On output the attributes reflect changes made by the user.
144 * @return print service selected by the user, or null if the user
145 * cancelled the dialog.
146 * @throws HeadlessException if GraphicsEnvironment.isHeadless()
147 * returns true.
148 * @throws IllegalArgumentException if services is null or empty,
149 * or attributes is null, or the initial PrintService is not in the
150 * list of browsable services.
151 */
152 public static PrintService printDialog(GraphicsConfiguration gc,
153 int x, int y,
154 PrintService[] services,
|