Java Code Examples for javax.print.PrintServiceLookup#registerService()

The following examples show how to use javax.print.PrintServiceLookup#registerService() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PrintDialog.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    // instruction dialog
    Frame instruction = new Frame("Verify that no native print dialog is showed");
    instruction.add(new TextArea(instructions));
    instruction.pack();
    instruction.show();
    // test begin
    PrintServiceStub service = new PrintServiceStub("test");
    PrintServiceLookup.registerService(service);
    PrinterJob job = PrinterJob.getPrinterJob();
    job.setPrintService(service);
    job.printDialog();
    System.out.println("test passed");
}
 
Example 2
Source File: PrintDialog.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    // instruction dialog
    Frame instruction = new Frame("Verify that no native print dialog is showed");
    instruction.add(new TextArea(instructions));
    instruction.pack();
    instruction.show();
    // test begin
    PrintServiceStub service = new PrintServiceStub("test");
    PrintServiceLookup.registerService(service);
    PrinterJob job = PrinterJob.getPrinterJob();
    job.setPrintService(service);
    job.printDialog();
    System.out.println("test passed");
}
 
Example 3
Source File: PrintDialog.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    // instruction dialog
    Frame instruction = new Frame("Verify that no native print dialog is showed");
    instruction.add(new TextArea(instructions));
    instruction.pack();
    instruction.show();
    // test begin
    PrintServiceStub service = new PrintServiceStub("test");
    PrintServiceLookup.registerService(service);
    PrinterJob job = PrinterJob.getPrinterJob();
    job.setPrintService(service);
    job.printDialog();
    System.out.println("test passed");
}
 
Example 4
Source File: PrintDialog.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    // instruction dialog
    Frame instruction = new Frame("Verify that no native print dialog is showed");
    instruction.add(new TextArea(instructions));
    instruction.pack();
    instruction.show();
    // test begin
    PrintServiceStub service = new PrintServiceStub("test");
    PrintServiceLookup.registerService(service);
    PrinterJob job = PrinterJob.getPrinterJob();
    job.setPrintService(service);
    job.printDialog();
    System.out.println("test passed");
}
 
Example 5
Source File: PrintDialog.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    // instruction dialog
    Frame instruction = new Frame("Verify that no native print dialog is showed");
    instruction.add(new TextArea(instructions));
    instruction.pack();
    instruction.show();
    // test begin
    PrintServiceStub service = new PrintServiceStub("test");
    PrintServiceLookup.registerService(service);
    PrinterJob job = PrinterJob.getPrinterJob();
    job.setPrintService(service);
    job.printDialog();
    System.out.println("test passed");
}
 
Example 6
Source File: DummyPrintTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    // register custom print service implementation
    String printerName = "myDummyPrintService";
    PrintServiceLookup.registerService(new DummyPrintService(printerName));
    // calling third party print logic
    thirdPartyPrintLogic(printerName);
}
 
Example 7
Source File: PrintDialog.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    // instruction dialog
    Frame instruction = new Frame("Verify that no native print dialog is showed");
    instruction.add(new TextArea(instructions));
    instruction.pack();
    instruction.show();
    // test begin
    PrintServiceStub service = new PrintServiceStub("test");
    PrintServiceLookup.registerService(service);
    PrinterJob job = PrinterJob.getPrinterJob();
    job.setPrintService(service);
    job.printDialog();
    System.out.println("test passed");
}
 
Example 8
Source File: RegisterNullService.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main (String [] args) throws RuntimeException {

        boolean registered = PrintServiceLookup.registerService(null);
        if (registered) {
           throw new RuntimeException("Null service was registered");
        }
        PrintService[] services =
            PrintServiceLookup.lookupPrintServices(null, null);
        for (int i = 0; i < services.length; i++) {
            if (services[i] == null) {
                throw new RuntimeException("Null service found.");
            }
        }
    }
 
Example 9
Source File: PrintDialog.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    // instruction dialog
    Frame instruction = new Frame("Verify that no native print dialog is showed");
    instruction.add(new TextArea(instructions));
    instruction.pack();
    instruction.show();
    // test begin
    PrintServiceStub service = new PrintServiceStub("test");
    PrintServiceLookup.registerService(service);
    PrinterJob job = PrinterJob.getPrinterJob();
    job.setPrintService(service);
    job.printDialog();
    System.out.println("test passed");
}
 
Example 10
Source File: PrintDialog.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    // instruction dialog
    Frame instruction = new Frame("Verify that no native print dialog is showed");
    instruction.add(new TextArea(instructions));
    instruction.pack();
    instruction.show();
    // test begin
    PrintServiceStub service = new PrintServiceStub("test");
    PrintServiceLookup.registerService(service);
    PrinterJob job = PrinterJob.getPrinterJob();
    job.setPrintService(service);
    job.printDialog();
    System.out.println("test passed");
}
 
Example 11
Source File: PrintDialog.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    // instruction dialog
    Frame instruction = new Frame("Verify that no native print dialog is showed");
    instruction.add(new TextArea(instructions));
    instruction.pack();
    instruction.show();
    // test begin
    PrintServiceStub service = new PrintServiceStub("test");
    PrintServiceLookup.registerService(service);
    PrinterJob job = PrinterJob.getPrinterJob();
    job.setPrintService(service);
    job.printDialog();
    System.out.println("test passed");
}
 
Example 12
Source File: PrintDialog.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    // instruction dialog
    Frame instruction = new Frame("Verify that no native print dialog is showed");
    instruction.add(new TextArea(instructions));
    instruction.pack();
    instruction.show();
    // test begin
    PrintServiceStub service = new PrintServiceStub("test");
    PrintServiceLookup.registerService(service);
    PrinterJob job = PrinterJob.getPrinterJob();
    job.setPrintService(service);
    job.printDialog();
    System.out.println("test passed");
}
 
Example 13
Source File: PrintDialog.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    // instruction dialog
    Frame instruction = new Frame("Verify that no native print dialog is showed");
    instruction.add(new TextArea(instructions));
    instruction.pack();
    instruction.show();
    // test begin
    PrintServiceStub service = new PrintServiceStub("test");
    PrintServiceLookup.registerService(service);
    PrinterJob job = PrinterJob.getPrinterJob();
    job.setPrintService(service);
    job.printDialog();
    System.out.println("test passed");
}
 
Example 14
Source File: PrintDialog.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    // instruction dialog
    Frame instruction = new Frame("Verify that no native print dialog is showed");
    instruction.add(new TextArea(instructions));
    instruction.pack();
    instruction.show();
    // test begin
    PrintServiceStub service = new PrintServiceStub("test");
    PrintServiceLookup.registerService(service);
    PrinterJob job = PrinterJob.getPrinterJob();
    job.setPrintService(service);
    job.printDialog();
    System.out.println("test passed");
}
 
Example 15
Source File: PrintDialog.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    // instruction dialog
    Frame instruction = new Frame("Verify that no native print dialog is showed");
    instruction.add(new TextArea(instructions));
    instruction.pack();
    instruction.show();
    // test begin
    PrintServiceStub service = new PrintServiceStub("test");
    PrintServiceLookup.registerService(service);
    PrinterJob job = PrinterJob.getPrinterJob();
    job.setPrintService(service);
    job.printDialog();
    System.out.println("test passed");
}