示例#1
0
 public void actionPerformed(ActionEvent e) {
   PrintJob pjob = getToolkit().getPrintJob(textViewerFrame, "Printing Nslm", null);
   if (pjob != null) {
     Graphics pg = pjob.getGraphics();
     if (pg != null) {
       // todo: this should print from
       // the file not from the screen.
       // if (editor1!=null) {
       //    editor1.print(pg); //print crashes, must use printAll
       // }
       // if (scroller1!=null) {
       //    scroller1.printAll(pg); //is clipping on left
       // }
       if (scroller1 != null) {
         JViewport jvp = scroller1.getViewport();
         jvp.printAll(pg);
       }
       pg.dispose();
     }
     pjob.end();
   }
 }