This code hangs forever on the last line.
The result should probably be an exception since one is trying to print after the last page.
PrinterJob pj = PrinterJob.createPrinterJob();
pj.getJobSettings().setPageRanges(new PageRange(1, 1));
pj.printPage(new Label("Page 1"));
pj.printPage(new Label("Page 2 - one too much"));
Labelling as critical since a small programming error might hang the whole app without any way of knowing the reason.
The result should probably be an exception since one is trying to print after the last page.
PrinterJob pj = PrinterJob.createPrinterJob();
pj.getJobSettings().setPageRanges(new PageRange(1, 1));
pj.printPage(new Label("Page 1"));
pj.printPage(new Label("Page 2 - one too much"));
Labelling as critical since a small programming error might hang the whole app without any way of knowing the reason.
- relates to
-
JDK-8142939 Can't print when print range is set to "from 1 to 1".
- Open