Guest User

Untitled

a guest
Oct 17th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. import java.awt.print.*;
  2.  
  3. public class PrintTest
  4. {
  5. public static void main(String [] args)
  6. {
  7. Patient myPatient = new Patient("Saeid", "Wazzan", 21);
  8.  
  9. PrinterJob job = PrinterJob.getPrinterJob();
  10. job.setPrintable(myPatient);
  11.  
  12. boolean doPrint = job.printDialog();
  13.  
  14. if (doPrint)
  15. {
  16. try {
  17. job.print();
  18. } catch (PrinterException e) {
  19. System.out.println("Failed to print");
  20. }
  21. }
  22. }
  23. }
Add Comment
Please, Sign In to add comment