public void Print() { // If they didn't provide a mech exit if (Mechs.size() == 0) { return; } job.setJobName(jobName.trim()); // Here is where we will show the print dialog, determine if it's a single mech or multiples if (useDialog) { if (Mechs.size() == 1) { if (!PrintDialog((PrintMech) Mechs.get(0))) return; } else { if (!BatchDialog()) return; } } // start building the print objects necessary GeneratePrints(); job.setPageable(pages); boolean DoPrint = job.printDialog(); if (DoPrint) { try { job.print(); } catch (PrinterException e) { System.err.println(e.getMessage()); System.out.println(e.getStackTrace()); } Mechs.clear(); } }
public void PrintSingles() { if (Mechs.size() == 0) { return; } page.setPaper(paper); if (useDialog) { if (Mechs.size() == 1) { if (!PrintDialog((PrintMech) Mechs.get(0))) return; } else { if (!BatchDialog()) return; } } for (int index = 0; index <= Mechs.size() - 1; index++) { PrintMech pm = (PrintMech) Mechs.get(index); job.setJobName(pm.CurMech.GetFullName().trim()); job.setPrintable(pm); try { job.print(); } catch (PrinterException ex) { Logger.getLogger(Printer.class.getName()).log(Level.SEVERE, null, ex); } } }
public void PrintBattleforce() { if (battleforces.size() == 0) { return; } pages = new Book(); page.setPaper(paper); if (jobName.isEmpty()) { jobName = "BattleForce"; } if (battleforces.size() == 1) { BattleForce bf = ((BattleforcePrinter) battleforces.get(0)).getBattleforce(); if (!bf.ForceName.isEmpty()) { jobName = bf.ForceName.trim(); } } job.setJobName(jobName); if (useDialog) { for (int i = 0; i < battleforces.size(); i++) { BattleforcePrinter bf = (BattleforcePrinter) battleforces.get(i); dlgPrintBattleforce pForce = new dlgPrintBattleforce((javax.swing.JFrame) Parent, true, bf.getBattleforce()); pForce.setLocationRelativeTo((javax.swing.JFrame) Parent); pForce.setVisible(true); if (!pForce.Result) { return; } bf.setType(pForce.Sheet); } } for (int i = 0; i < battleforces.size(); i++) { pages.append((BattleforcePrinter) battleforces.get(i), page); } job.setPageable(pages); boolean DoPrint = job.printDialog(); if (DoPrint) { try { job.print(); } catch (PrinterException e) { System.err.println(e.getMessage()); System.out.println(e.getStackTrace()); } } }