public class ServiceUI {
public static PrintService printDialog(GraphicsConfiguration gc, int x, int y,
PrintService[] services, PrintService defaultService, DocFlavor flavor,
PrintRequestAttributeSet attributes) throws HeadlessException {
if (GraphicsEnvironment.isHeadless()) {
throw new HeadlessException();
}
int initialIndex = checkServices(services, defaultService, attributes);
Window activeWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager()
.getActiveWindow();
Window dialogOwner = getDialogOwner(activeWindow);