예제 #1
0
 /** This internal method begins a new line */
 protected void newline() {
   charnum = 0; // Reset character number to 0
   linenum++; // Increment line number
   if (linenum >= lines_per_page) { // If we've reached the end of the page
     page.dispose(); //    send page to printer
     page = null; //    but don't start a new page yet.
   }
 }
예제 #2
0
파일: LJ3MDApp.java 프로젝트: eskilj/mvp
 /**
  * Prepare a buffer for the image, return if the canvas is ready Only need to call this when the
  * size of the canvas is changed, Since we automatically detect the size change in paint() only
  * call this on start
  */
 public boolean newImgBuf() {
   Dimension sz = getSize();
   if (sz.width == 0 || sz.height == 0) return false;
   // quit if the current image already has the right size
   if (img != null && imgG != null && sz.equals(imgSize)) return true;
   img = createImage(sz.width, sz.height);
   if (imgG != null) imgG.dispose();
   imgG = img.getGraphics();
   imgSize = sz;
   return true;
 }
예제 #3
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
   }
 }