/** Prints the drawing. */
  public void print() {
    tool().deactivate();
    PrintJob printJob = getToolkit().getPrintJob(this, "Print Drawing", null);

    if (printJob != null) {
      Graphics pg = printJob.getGraphics();

      if (pg != null) {
        ((StandardDrawingView) view()).printAll(pg);
        pg.dispose(); // flush page
      }
      printJob.end();
    }
    tool().activate();
  }
Esempio n. 2
0
  public void actionPerformed(ActionEvent e) {
    String cmd = e.getActionCommand();
    if (cmd.equals("print")) {
      PrintJob pjob = getToolkit().getPrintJob(this, "RoundedRectTest", null);
      if (pjob != null) {
        Graphics pg = pjob.getGraphics();

        if (pg != null) {
          canvas.printAll(pg);
          pg.dispose(); // flush page
        }

        pjob.end();
      }
    }
  }
 // If all is true, loop through all selections in chart, asking it to
 // grab the data and print each one.
 public void print(boolean all) {
   Toolkit tk = getToolkit();
   PrintJob pj =
       tk.getPrintJob(chart, all ? "All charts" : chart.current_tradable(), print_properties);
   if (pj != null) {
     if (all) {
       Vector selections = chart.tradable_selections().selections();
       for (int i = 0; i < selections.size(); ++i) {
         chart.request_data((String) selections.elementAt(i));
         if (chart.request_result_id() == Ok) {
           print_current_chart(pj);
         }
       }
     } else {
       print_current_chart(pj);
     }
     pj.end();
   }
 }
Esempio n. 4
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();
   }
 }
Esempio n. 5
0
 /**
  * This is the close() method that all Writer subclasses must implement. Print the pending page
  * (if any) and terminate the PrintJob.
  */
 public void close() {
   synchronized (this.lock) {
     if (page != null) page.dispose(); // Send page to the printer
     job.end(); // Terminate the job
   }
 }