Implement the print function of Form in Java

zhaozj2021-02-08  215

Print function for FORM in Java

Public void print (jframe frame) {Container Container = frame.getContentPane (); Properties Prop = New Properties ();

PrintJob Job = getToolkit (). GetPrintJob (Frame, "Test", Prop); // printJob Job = GetToolkit (). GetPrintJob (this, "test", prop); if (job! = Null) {graphics pg = Job .getgraphics (); if (pg! = null) {pg.Translate (). width-getSize (). width/2/2 (Job.getPageDimension (). Height-getSize (). HEIGHT) / 2); // Old Code - Container.print (pg); Print (pg); pg.dispose ();

Job.end ();}} Job = NULL;

转载请注明原文地址:https://www.9cbs.com/read-3008.html

New Post(0)