一个范例,看明白了就会做了
void printReportTable(ActionEvent e) {
Toolkit theKit = this.getToolkit();
PrintJob print = theKit.getPrintJob(this,"Printing Report",null);
if (print == null) {
AlertDialog tDialog = new AlertDialog(this,"No Print Job Object Created");
}
Dimension printArea = print.getPageDimension();
// printing
Graphics printG = print.getGraphics();
this.scrollPane.print(printG);
// this.reportTable.print(printG);
printG.dispose();
print.end();
}