如何使用某些值

时间:2017-09-24 05:32:05

标签: java swing printing

我尝试按此顺序打印一些数据:

  1. 赫德
  2. 日期(JTextField中)
  3. 发票号(Jtextfield)
  4. 的JTable
  5. 金额(Jtextfield)
  6. 页脚

     MessageFormat header = new MessageFormat("Building Materials Coperation Ltd");
     MessageFormat footer = new MessageFormat("Thank you! Come again..");
     MessageFormat Date = new MessageFormat("Date " + txt_date.getText());
     MessageFormat Inoice_no = new MessageFormat("Invoice No " + txt_invoice_no.getText());
     MessageFormat Amount = new MessageFormat("Total Amount:- Rs" + txt_Total_amount.getText());
    
    
     try {
     PrintRequestAttributeSet set = new HashPrintRequestAttributeSet();
    
     jTable2.print(JTable.PrintMode.FIT_WIDTH, header, Date, false, set, false);
     jTable2.print(JTable.PrintMode.FIT_WIDTH, Inoice_no, Amount, false, set, false);
     jTable2.print(JTable.PrintMode.FIT_WIDTH, Inoice_no, footer, false, set, false);
    
     } catch (java.awt.print.PrinterException e) {
     JOptionPane.showMessageDialog(null, "\n" + "Error from Printer Job "
          + "\n" + e);   
     }
    
  7. 所以我有打印但是,它有3个弹出窗口打印它 我如何按顺序打印

    我希望,你会帮助我找到它  (你能给我和例子,它的大帮助) 感谢

0 个答案:

没有答案