コード例 #1
0
  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);
      }
    }
  }
コード例 #2
0
 public Book PreviewBattleforce() {
   if (battleforces.size() == 0) {
     return new Book();
   }
   pages = new Book();
   page.setPaper(paper);
   for (int i = 0; i < battleforces.size(); i++) {
     pages.append(((BattleforceCardPrinter) battleforces.get(i)), page);
   }
   return pages;
 }
コード例 #3
0
  private void GeneratePrints() {
    // reset the book so we don't get extra pages!
    pages = new Book();

    // start building the print objects necessary
    page.setPaper(paper);

    for (int index = 0; index <= Mechs.size() - 1; index++) {
      PrintMech pm = (PrintMech) Mechs.get(index);
      pages.append(pm, page);
      if (Mechs.size() == 1) job.setJobName(pm.CurMech.GetFullName().trim());
    }
  }
コード例 #4
0
  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());
      }
    }
  }