Tabnine Logo
ServiceUI
Code IndexAdd Tabnine to your IDE (free)

How to use
ServiceUI
in
javax.print

Best Java code snippets using javax.print.ServiceUI (Showing top 4 results out of 315)

origin: stackoverflow.com

 DocFlavor flavor = DocFlavor.BYTE_ARRAY.AUTOSENSE; 
PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();

PrintService[] printerArray = dialogPrinters.toArray(new PrintService[dialogPrinters.size()]);

// call print dialog and get print attributes
PrintService selectedPrinter = javax.print.ServiceUI.printDialog(null, 200, 200, printerArray, defaultPrintService, flavor, pras);  

// check if "print-to-file" option used
if (pras.get(Destination.class) != null)
{
  // here we deny to perform the save into a file
  JOptionPane.showMessageDialog(CMSJRViewer.this, getBundleString("error.printing"));
  throw new PrintException("Print to file option not allowed. Action aborted!");
}
else
{
  ...
}
origin: org.icepdf.os/icepdf-viewer

  /**
   * Utility for creating a print setup dialog.
   *
   * @return print service selected by the user, or null if the user
   * cancelled the dialog.
   */
  private PrintService getSetupDialog() {
    final int offset = 50;
    // find graphic configuration for the window the viewer is in.
    Window window = SwingUtilities.getWindowAncestor(
        container);
    GraphicsConfiguration graphicsConfiguration =
        window == null ? null : window.getGraphicsConfiguration();
    // try and trim the services list.
//        services = new PrintService[]{services[0]};

    return ServiceUI.printDialog(graphicsConfiguration,
        container.getX() + offset,
        container.getY() + offset,
        services, services[0],
        DocFlavor.SERVICE_FORMATTED.PRINTABLE,
        printRequestAttributeSet);
  }

origin: cuba-labs/java-electron-tutorial

private void printHelloDocument(String value) {
  PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
  DocFlavor flavor = DocFlavor.READER.TEXT_PLAIN;
  Doc doc = new SimpleDoc(new StringReader(value), flavor, null);
  PrintService[] services = PrintServiceLookup.lookupPrintServices(flavor, aset);
  PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService();
  if (services.length == 0) {
    if (defaultService == null) {
      new Notification("No printer found", WARNING_MESSAGE).show(getPage());
    } else {
      DocPrintJob job = defaultService.createPrintJob();
      printDocument(doc, aset, job);
    }
  } else {
    SwingUtilities.invokeLater(() -> {
      PrintService service = ServiceUI.printDialog(null, 200, 200,
          services, defaultService, flavor, aset);
      if (service != null) {
        DocPrintJob job = service.createPrintJob();
        printDocument(doc, aset, job);
      }
    });
  }
}
origin: com.fifesoft.rtext/fife.common

PrintService chosenService = ServiceUI.printDialog(null, 200, 200, services, defaultService,
              flavor, attributeSet);
if (chosenService != null) {
javax.printServiceUI

Most used methods

  • printDialog

Popular in Java

  • Start an intent from android
  • getSharedPreferences (Context)
  • startActivity (Activity)
  • getContentResolver (Context)
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • JPanel (javax.swing)
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now