Esempio n. 1
0
  @Override
  public int print(Graphics g, PageFormat pf, int pageIndex) throws PrinterException {
    System.out.println("PageFormat: width=" + pf.getWidth() + ", height=" + pf.getHeight());
    Logger.getGlobal().log(Level.INFO, "PageFormat {0}", pf);
    System.out.println("pageIndex " + pageIndex);
    Logger.getGlobal().log(Level.INFO, "pageIndex {0}", pageIndex);

    if (pageIndex == 0) {
      Graphics2D g2d = (Graphics2D) g;
      Font font = g2d.getFont();
      g2d.setFont(font.deriveFont((float) fontSize));

      g2d.translate(pf.getImageableX(), pf.getImageableY());
      g2d.setColor(Color.black);
      int step = g2d.getFont().getSize();
      step += step / 4;
      double y = paddingTop + g2d.getFont().getSize();
      for (String s : printStringList) {
        Logger.getGlobal().log(Level.INFO, "printStringList: {0}", s);
        g2d.drawString(s, (float) paddingLeft, (float) y);
        y += step;
      }

      // g2d.fillRect(0, 0, 200, 200);
      return Printable.PAGE_EXISTS;

    } else {
      return Printable.NO_SUCH_PAGE;
    }
  }
Esempio n. 2
0
  public void paint(Graphics g) {
    gRef = (Graphics2D) g;

    // change size of font
    gRef.setFont(gRef.getFont().deriveFont(9.0f));

    fmRef = g.getFontMetrics();

    // Clear background

    if (Preferences.monochrome) {
      gRef.setColor(Preferences.whiteColor);
    } else {
      gRef.setColor(Preferences.backgroundColor);
    }
    gRef.fillRect(0, 0, getWidth(), getHeight());

    // set colour to correct drawing colour
    if (Preferences.monochrome) {
      gRef.setColor(Preferences.blackColor);
    } else {
      gRef.setColor(Preferences.penColor);
    }

    gRef.translate(0, margin);

    // Call c code to draw tree
    gRef.scale(scale, scale);
    nativeDrawTree();
  }
  @Override
  public int print(Graphics g, PageFormat pf, int page) throws PrinterException {
    if (page > 0) {
      return NO_SUCH_PAGE;
    }

    int i = pf.getOrientation();

    // get the size of the page
    double pageWidth = pf.getImageableWidth();
    double pageHeight = pf.getImageableHeight();
    double myWidth = this.getWidth(); // - borderWidth * 2;
    double myHeight = this.getHeight(); // - borderWidth * 2;
    double scaleX = pageWidth / myWidth;
    double scaleY = pageHeight / myHeight;
    double minScale = Math.min(scaleX, scaleY);

    Graphics2D g2d = (Graphics2D) g;
    g2d.translate(pf.getImageableX(), pf.getImageableY());
    g2d.scale(minScale, minScale);

    drawPlot(g);

    return PAGE_EXISTS;
  }
Esempio n. 4
0
    public int print(Graphics g, PageFormat pgFmt, int pgIndex) {
      if (pgIndex > 0) return Printable.NO_SUCH_PAGE;

      Graphics2D g2d = (Graphics2D) g;
      g2d.translate(pgFmt.getImageableX(), pgFmt.getImageableY());
      doPaint(g2d);
      return Printable.PAGE_EXISTS;
    }
Esempio n. 5
0
  public int print(Graphics g, PageFormat pf, int page) throws PrinterException {
    Graphics2D g2 = (Graphics2D) g;
    if (page > getPageCount(g2, pf)) return Printable.NO_SUCH_PAGE;
    g2.translate(pf.getImageableX(), pf.getImageableY());

    drawPage(g2, pf, page);
    return Printable.PAGE_EXISTS;
  }
Esempio n. 6
0
        public int print(Graphics g,PageFormat pf,int pageIndex) {

                if (pageIndex == 0) {
                        Graphics2D g2d= (Graphics2D)g;
                        g2d.translate(pf.getImageableX(), pf.getImageableY()); 
                        g2d.setColor(Color.black);
                        g2d.drawString("example string", 250, 250);
                        g2d.fillRect(0, 0, 200, 200);
                        return Printable.PAGE_EXISTS;                                   
                } else {
                        return Printable.NO_SUCH_PAGE;
                }
        }
Esempio n. 7
0
 /** [Internal] */
 public int print(Graphics g, PageFormat pf, int pi) throws PrinterException {
   if (pi >= 1) {
     return Printable.NO_SUCH_PAGE;
   }
   RepaintManager currentManager = RepaintManager.currentManager(this);
   currentManager.setDoubleBufferingEnabled(false);
   Graphics2D g2 = (Graphics2D) g;
   initState(g2, true);
   g2.translate((int) (pf.getImageableX() + 1), (int) (pf.getImageableY() + 1));
   g2.scale(printScale, printScale);
   doBuffer(g2, true, null);
   currentManager.setDoubleBufferingEnabled(true);
   return Printable.PAGE_EXISTS;
 }
Esempio n. 8
0
  public int print(Graphics g, PageFormat pf, int pageIndex) {
    int response = NO_SUCH_PAGE;

    Graphics2D g2 = (Graphics2D) g;
    disableDoubleBuffering(componentToBePrinted);
    Dimension d = componentToBePrinted.getSize();
    double panelWidth = d.width;
    double panelHeight = d.height;
    double pageHeight = pf.getImageableHeight();
    double pageWidth = pf.getImageableWidth();
    double scale = pageWidth / panelWidth;
    int totalNumPages = (int) Math.ceil(scale * panelHeight / pageHeight);
    if (pageIndex >= totalNumPages) {
      response = NO_SUCH_PAGE;
    } else {
      g2.translate(pf.getImageableX(), pf.getImageableY());
      g2.translate(0f, -pageIndex * pageHeight);
      g2.scale(scale, scale);
      componentToBePrinted.paint(g2);
      enableDoubleBuffering(componentToBePrinted);
      response = Printable.PAGE_EXISTS;
    }
    return response;
  }
Esempio n. 9
0
  public void drawPage(Graphics2D g2, PageFormat pf, int page) {
    if (message.equals("")) return;
    page--; // account for cover page

    drawCropMarks(g2, pf);
    g2.clip(new Rectangle2D.Double(0, 0, pf.getImageableWidth(), pf.getImageableHeight()));
    g2.translate(-page * pf.getImageableWidth(), 0);
    g2.scale(scale, scale);
    FontRenderContext context = g2.getFontRenderContext();
    Font f = new Font("Serif", Font.PLAIN, 72);
    TextLayout layout = new TextLayout(message, f, context);
    AffineTransform transform = AffineTransform.getTranslateInstance(0, layout.getAscent());
    Shape outline = layout.getOutline(transform);
    g2.draw(outline);
  }
  public int print(Graphics g, PageFormat pf, int pageIndex) throws PrinterException {
    // Component printMe = getPrintComponent();

    Graphics2D g2 = (Graphics2D) g;
    g2.setColor(Color.black); // set default foreground color to black

    // for faster printing, turn off double buffering
    // RepaintManager.currentManager(this).setDoubleBufferingEnabled(false);

    Dimension d = printComponent.getSize(); // get size of document
    double panelWidth = d.width; // width in pixels
    double panelHeight = d.height; // height in pixels
    double pageHeight = pf.getImageableHeight(); // height of printer page
    double pageWidth = pf.getImageableWidth(); // width of printer page
    double scale = pageWidth / panelWidth;
    int totalNumPages = (int) Math.ceil(scale * panelHeight / pageHeight);

    // make sure we don't print empty pages
    if (pageIndex >= totalNumPages) {
      return Printable.NO_SUCH_PAGE;
    }

    // shift Graphic to line up with beginning of print-imageable region
    g2.translate(pf.getImageableX(), pf.getImageableY());

    // shift Graphic to line up with beginning of next page to print
    g2.translate(0f, -pageIndex * pageHeight);

    // scale the page so the width fits...
    g2.scale(scale, scale);

    // PRINT IT!
    printComponent.paint(g2);

    return Printable.PAGE_EXISTS;
  }
Esempio n. 11
0
  @Override
  public int print(Graphics g, PageFormat pf, int pageIndex) throws PrinterException {
    Graphics2D g2;

    if (pageIndex > 0) return Printable.NO_SUCH_PAGE;

    g2 = (Graphics2D) g;

    g2.translate(pf.getImageableX(), pf.getImageableY());

    Dimension imageSize = calcDimension(image, pf.getImageableWidth(), pf.getImageableHeight());

    g2.drawImage(
        image,
        (int) (pf.getImageableWidth() / 2 - imageSize.width / 2),
        (int) (pf.getImageableHeight() / 2 - imageSize.height / 2),
        imageSize.width,
        imageSize.height,
        this);

    g.setXORMode(Color.white);

    Font font = g2.getFont().deriveFont(6);
    g2.setFont(font);
    int fileNameWidth = g2.getFontMetrics(font).stringWidth(fileName);

    if (fileNameWidth > imageSize.width) {
      pathStrings = fileName.split("\\\\");
      result = pathStrings[0] + "\\...\\" + pathStrings[pathStrings.length - 1];
      resultWidth = g.getFontMetrics(font).stringWidth(result);

      // TODO:
      // Add another if for truncating to just a few letters if needed.
    } else {
      result = fileName;
      resultWidth = g.getFontMetrics(font).stringWidth(result);
    }

    g.drawString(
        result,
        (int) (pf.getImageableWidth() / 2 + imageSize.width / 2 - resultWidth - 5),
        (int) (pf.getImageableHeight() / 2 + imageSize.height / 2 - 5));
    return Printable.PAGE_EXISTS;
  }
Esempio n. 12
0
 /** This method is required to implement the Printable interface */
 public int print(Graphics g, PageFormat pageFormat, int pageIndex) throws PrinterException {
   if (pageIndex >= 1) {
     return NO_SUCH_PAGE;
   }
   Graphics2D g2 = (Graphics2D) g;
   Dimension cs = printTarget.getSize();
   g2.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
   double imageableWidth = pageFormat.getImageableWidth();
   double imageableHeight = pageFormat.getImageableHeight();
   double scale = 1;
   if (cs.width >= imageableWidth) {
     scale = imageableWidth / cs.width;
   }
   g2.scale(scale, scale);
   // g2.translate((imageableWidth - cs.width)*scale/2,
   //             (imageableHeight - cs.height)*scale/2);
   printTarget.paintAll(g2);
   return Printable.PAGE_EXISTS;
 }
Esempio n. 13
0
  public int print(Graphics g, PageFormat pageFormat, int pageIndex) {
    int lineHeight = fm.getHeight();
    int linesPerPage = (int) (pageFormat.getImageableHeight() / lineHeight);
    int lineCount = textArea.getLineCount();
    int lastPage = lineCount / linesPerPage;

    if (pageIndex > lastPage) {
      return NO_SUCH_PAGE;

    } else {
      Graphics2D g2d = (Graphics2D) g;
      TokenMarker tokenMarker = textArea.getDocument().getTokenMarker();
      int firstLine = pageIndex * linesPerPage;
      g2d.translate(
          Math.max(54, pageFormat.getImageableX()),
          pageFormat.getImageableY() - firstLine * lineHeight);
      printing = true;
      for (int line = firstLine; line < firstLine + linesPerPage; line++) {
        paintLine(g2d, tokenMarker, line, 0);
      }
      printing = false;
      return PAGE_EXISTS;
    }
  }
Esempio n. 14
0
  /**
   * The printing interface.
   *
   * @param g the graphic context.
   * @param pf the page format.
   * @param page the page number.
   * @return PAGE_EXISTS if the page has to be printed.
   * @throws PrinterException if a printing error occurs.
   */
  public int print(Graphics g, PageFormat pf, int page) throws PrinterException {
    int npages = 0;

    // This might be explained as follows:
    // 1 - The Java printing system normally works with an internal
    // resolution which is 72 dpi (probably inspired by Postscript).
    // 2 - To have a sufficient resolution, this is increased by 16 times,
    // by using the scale method of the graphic object associated to the
    // printer. This gives a 72 dpi * 16=1152 dpi resolution.
    // 3 - The 0.127 mm pitch used in FidoCadJ corresponds to a 200 dpi
    // resolution. Calculating 1152 dpi / 200 dpi gives the 5.76 constant

    double xscale = 1.0 / 16; // Set 1152 logical units for an inch
    double yscale = 1.0 / 16; // as the standard resolution is 72
    double zoom = 5.76; // act in a 1152 dpi resolution as 1:1

    Graphics2D g2d = (Graphics2D) g;

    // User (0,0) is typically outside the imageable area, so we must
    // translate by the X and Y values in the PageFormat to avoid clipping

    if (printMirror) {
      g2d.translate(pf.getImageableX() + pf.getImageableWidth(), pf.getImageableY());
      g2d.scale(-xscale, yscale);

    } else {
      g2d.translate(pf.getImageableX(), pf.getImageableY());
      g2d.scale(xscale, yscale);
    }

    int printerWidth = (int) pf.getImageableWidth() * 16;

    // Perform an adjustement if we need to fit the drawing to the page.
    if (printFitToPage) {
      MapCoordinates zoomm =
          DrawingSize.calculateZoomToFit(
              cc.dmp, (int) pf.getImageableWidth() * 16, (int) pf.getImageableHeight() * 16, false);
      zoom = zoomm.getXMagnitude();
    }

    MapCoordinates m = new MapCoordinates();

    m.setMagnitudes(zoom, zoom);

    PointG o = new PointG(0, 0);

    int imageWidth = DrawingSize.getImageSize(cc.dmp, zoom, false, o).width;
    npages = (int) Math.floor((imageWidth - 1) / (double) printerWidth);

    // Check if we need more than one page
    if (printerWidth < imageWidth) {
      g2d.translate(-(printerWidth * page), 0);
    }

    // Check if printing is finished.
    if (page > npages) {
      return NO_SUCH_PAGE;
    }
    // Now we perform our rendering
    cc.drawingAgent.draw(new Graphics2DSwing(g2d), m);

    /* tell the caller that this page is part of the printed document */
    return PAGE_EXISTS;
  }
  public int print(Graphics g, PageFormat pageFormat, int pageIndex) throws PrinterException {
    // Check there is something to print
    if (pageIndex >= maxNumPage || grid.getRowCount() == 0 || grid.getColumnCount() == 0) {
      return Printable.NO_SUCH_PAGE;
    }

    Graphics2D g2d = (Graphics2D) g;
    g2d.translate((int) pageFormat.getImageableX(), (int) pageFormat.getImageableY());

    int pageWidth = (int) pageFormat.getImageableWidth();
    int pageHeight = (int) pageFormat.getImageableHeight();
    int gridWidth = grid.getColumnModel().getTotalSize();
    int gridHeight = grid.getRowModel().getTotalSize();

    // Check there is something visible to print
    if (gridWidth == 0 || gridHeight == 0) {
      return Printable.NO_SUCH_PAGE;
    }

    // Calculate page to print
    int pageColumn = pageIndex % pageCols;
    int pageRow = pageIndex / pageCols;

    // Calculate scale to make the grid fit in maxNumPage
    float xFitPageScale = (pageWidth * pageCols) / (float) gridWidth;
    float yFitPageScale = (pageHeight * pageRows) / (float) gridHeight;
    float minScale = Math.min(xFitPageScale, yFitPageScale);

    // Scale the print area
    int pageX = (int) ((pageColumn * pageWidth) / minScale);
    int pageY = (int) ((pageRow * pageHeight) / minScale);
    pageWidth = (int) (pageWidth / minScale);
    pageHeight = (int) (pageHeight / minScale);

    // Get clip region for page
    Point p = new Point(pageX, pageY);
    int firstRow = grid.rowAtPoint(p);
    int firstCol = grid.columnAtPoint(p);
    int x1 = grid.getColumnPosition(firstCol);
    int y1 = grid.getRowPosition(firstRow);
    int x2 = x1 + pageWidth;
    int y2 = y1 + pageHeight;
    p = new Point(x2, y2);
    int lastRow = grid.rowAtPoint(p);
    int lastCol = grid.columnAtPoint(p);
    if (grid.getRowPosition(lastRow) + grid.getRowHeight(lastRow) > y2) {
      y2 = grid.getRowPosition(lastRow);
    } else {
      y2 = grid.getRowPosition(lastRow) + grid.getRowHeight(lastRow);
    }
    if (grid.getColumnPosition(lastCol) + grid.getColumnWidth(lastCol) > x2) {
      x2 = grid.getColumnPosition(lastCol);
    } else {
      x2 = grid.getColumnPosition(lastCol) + grid.getColumnWidth(lastCol);
    }
    int x = x1;
    int y = y1;
    int width = x2 - x1;
    int height = y2 - y1;

    SelectionSettings selectionSettings = new SelectionSettings(grid.getSelectionModel());
    selectionSettings.clear();

    // Print the page
    g2d.scale(minScale, minScale);
    g2d.translate(-x, -y);
    g2d.setClip(x, y, width, height);
    grid.print(g2d);

    selectionSettings.restore();

    return Printable.PAGE_EXISTS;
  }
Esempio n. 16
0
  public int print(Graphics g, PageFormat pf, int pageIndex) {
    Font f1 = new Font("SERIF", Font.PLAIN, 8);
    FontMetrics metric = g.getFontMetrics(f1);
    int lineHeight = metric.getHeight();

    if (pageBreak == null) {
      initLines();
      int s = (numLines % 3);
      if (s > 0) numLines = numLines + (3 - s);
      numLines /= 3;

      int linesPerPage = (int) (pf.getImageableHeight() / lineHeight);
      int numBreaks = (numLines / linesPerPage);
      pageBreak = new int[numBreaks];
      for (int b = 0; b < numBreaks; b++) {
        pageBreak[b] = (b + 1) * linesPerPage;
      }
    }

    if (pageIndex > pageBreak.length) {
      return NO_SUCH_PAGE;
    }

    Graphics2D g2d = (Graphics2D) g;
    g2d.translate(pf.getImageableX(), pf.getImageableY());

    int y = 0;

    g.setFont(new Font("SERIF", Font.PLAIN, 9));

    int start = 0;
    if (pageIndex == 0) start = 0;
    else start = pageBreak[pageIndex - 1];

    int end = 0;

    if (pageIndex == pageBreak.length) end = numLines;
    else end = pageBreak[pageIndex];

    if (chk % 2 == 1 && (end - start) != lineHeight) {

      for (int line = start; line < end && i < x; line += 9) {
        y += (2 * lineHeight);
        g.drawString("" + textLines[i][0], 30, y);
        g.drawString(textLines[i][1], 30, y + lineHeight);
        g.drawString(textLines[i][2], 30, y + 2 * lineHeight);
        g.drawString(textLines[i][3], 30, y + 3 * lineHeight);
        g.drawString(textLines[i][4], 30, y + 4 * lineHeight);
        g.drawString(textLines[i][5], 30, y + 5 * lineHeight);
        g.drawString(textLines[i][6], 30, y + 6 * lineHeight);

        if ((i + 1) < x) {
          g.drawString(textLines[i + 1][0], 225, y);
          g.drawString(textLines[i + 1][1], 225, y + lineHeight);
          g.drawString(textLines[i + 1][2], 225, y + 2 * lineHeight);
          g.drawString(textLines[i + 1][3], 225, y + 3 * lineHeight);
          g.drawString(textLines[i + 1][4], 225, y + 4 * lineHeight);
          g.drawString(textLines[i + 1][5], 225, y + 5 * lineHeight);
          g.drawString(textLines[i + 1][6], 225, y + 6 * lineHeight);
        }
        if ((i + 2) < x) {
          g.drawString(textLines[i + 2][0], 415, y);
          g.drawString(textLines[i + 2][1], 415, y + lineHeight);
          g.drawString(textLines[i + 2][2], 415, y + 2 * lineHeight);
          g.drawString(textLines[i + 2][3], 415, y + 3 * lineHeight);
          g.drawString(textLines[i + 2][4], 415, y + 4 * lineHeight);
          g.drawString(textLines[i + 2][5], 415, y + 5 * lineHeight);
          g.drawString(textLines[i + 2][6], 415, y + 6 * lineHeight);
        }
        y += 7 * lineHeight;
        i += 3;
      }

    } else {

      for (int line = start; line < end && i < x; line += 8) {}
    }
    chk++;

    return PAGE_EXISTS;
  }
Esempio n. 17
0
    public int print(Graphics gc, PageFormat format, int pageIndex)
        throws java.awt.print.PrinterException {
      if (pageIndex > 0) {
        out("page " + pageIndex + " requested, ending print job.");
        return Printable.NO_SUCH_PAGE;
      }

      Dimension page =
          new Dimension(
              (int) format.getImageableWidth() - 1, (int) format.getImageableHeight() - 1);

      Graphics2D g = (Graphics2D) gc;

      out(
          "asked to render page "
              + pageIndex
              + " in "
              + outpf(format)
              + " w/transform "
              + g.getTransform());

      // note: supposedly, perhaps on Windows with JVM's 1.5 and newer, the
      // transform scale provided can actually allow us to derive the DPI of the
      // print device, which we could use for image rendering optimization's
      // during prints.  Mac OS X Snow Leopard w/JVM 1.6 always reports a 1.0
      // scale though.  And operations like "print preview" or "print to PDF"
      // wouldn't have a fixed DPI anyway.

      if (DEBUG.CONTAINMENT) {
        g.setColor(Color.lightGray);
        g.fillRect(0, 0, 9999, 9999);
      }

      g.translate(format.getImageableX(), format.getImageableY());

      // Don't need to clip if printing whole map, as computed zoom
      // should have made sure everything is within page size
      // if (!isPrintingView())
      // g.clipRect(0, 0, page.width, page.height);

      if (DEBUG.CONTAINMENT) {
        // g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f));
        // draw border outline of page
        g.setColor(Color.gray);
        g.setStroke(VueConstants.STROKE_TWO);
        g.drawRect(0, 0, page.width, page.height);
        // g.setComposite(AlphaComposite.Src);
      }

      // compute zoom & offset for visible map components
      Point2D.Float offset = new Point2D.Float();
      // center vertically only if landscape mode
      // if (format.getOrientation() == PageFormat.LANDSCAPE)
      // TODO: allow horizontal centering, but not vertical centering (handle in computeZoomFit)
      double scale = ZoomTool.computeZoomFit(page, 5, bounds, offset, true);
      out("rendering at scale " + scale);
      // set up the DrawContext
      DrawContext dc =
          new DrawContext(
              g, scale, -offset.x, -offset.y,
              null, // frame would be the PageFormat offset & size rectangle
              focal, false); // todo: absolute links shouldn't be spec'd here

      dc.setMapDrawing();
      dc.setPrintQuality();

      if (isPrintingView() && map == focal)
        g.clipRect(
            (int) Math.floor(bounds.getX()),
            (int) Math.floor(bounds.getY()),
            (int) Math.ceil(bounds.getWidth()),
            (int) Math.ceil(bounds.getHeight()));

      if (DEBUG.CONTAINMENT) {
        g.setColor(Color.red);
        g.setStroke(VueConstants.STROKE_TWO);
        g.draw(bounds);
      }

      // render the map
      if (map == focal) map.draw(dc);
      else focal.draw(dc);

      out("page " + pageIndex + " rendered.");
      return Printable.PAGE_EXISTS;
    }
Esempio n. 18
0
 // also clip, transform, composite,
 // public boolean isOpaque(){return false;}//theOpaque!=null&&theOpaque;}
 // ---------------------------------------------------------
 private void doPaint(Graphics2D g, int s, Object o) {
   // process an operation from the buffer
   // System.out.println(s);
   Object o1 = null,
       o2 = null,
       o3 = null,
       o4 = null,
       o5 = null,
       o6 = null,
       o7 = null,
       o8 = null,
       o9 = null,
       o10 = null,
       o11 = null;
   if (o instanceof Object[]) {
     Object[] a = (Object[]) o;
     if (a.length > 0) o1 = a[0];
     if (a.length > 1) o2 = a[1];
     if (a.length > 2) o3 = a[2];
     if (a.length > 3) o4 = a[3];
     if (a.length > 4) o5 = a[4];
     if (a.length > 5) o6 = a[5];
     if (a.length > 6) o7 = a[6];
     if (a.length > 7) o8 = a[7];
     if (a.length > 8) o9 = a[8];
     if (a.length > 9) o10 = a[9];
     if (a.length > 10) o11 = a[10];
   }
   switch (s) {
     case clear:
       paintBackground(g, theBackground);
       break;
       // public void addRenderingHints(Map<?,?> hints)
       // {toBuffer("addRenderingHints",hints );}
     case addRenderingHints:
       g.addRenderingHints((Map<?, ?>) o);
       break;
     case clip1:
       g.clip((Shape) o);
       break;
     case draw1:
       g.draw((Shape) o);
       break;
     case draw3DRect:
       g.draw3DRect((Integer) o1, (Integer) o2, (Integer) o3, (Integer) o4, (Boolean) o5);
       break;
     case drawGlyphVector:
       g.drawGlyphVector((GlyphVector) o1, (Float) o2, (Float) o3);
       break;
     case drawImage1:
       g.drawImage((BufferedImage) o1, (BufferedImageOp) o2, (Integer) o3, (Integer) o4);
       break;
     case drawImage2:
       g.drawImage((Image) o1, (AffineTransform) o2, (ImageObserver) o3);
       break;
     case drawRenderableImage:
       g.drawRenderableImage((RenderableImage) o1, (AffineTransform) o2);
       break;
     case drawRenderedImage:
       g.drawRenderedImage((RenderedImage) o1, (AffineTransform) o2);
       break;
     case drawString1:
       g.drawString((AttributedCharacterIterator) o1, (Float) o2, (Float) o3);
       break;
     case drawString2:
       g.drawString((AttributedCharacterIterator) o1, (Integer) o2, (Integer) o3);
       break;
     case drawString3:
       g.drawString((String) o1, (Float) o2, (Float) o3);
       break;
     case drawString4:
       g.drawString((String) o1, (Integer) o2, (Integer) o3);
       break;
     case fill:
       g.fill((Shape) o);
       break;
     case fill3DRect:
       g.fill3DRect((Integer) o1, (Integer) o2, (Integer) o3, (Integer) o4, (Boolean) o5);
       break;
     case rotate1:
       g.rotate((Double) o);
       break;
     case rotate2:
       g.rotate((Double) o1, (Double) o2, (Double) o3);
       break;
     case scale1:
       g.scale((Double) o1, (Double) o2);
       break;
     case setBackground:
       g.setBackground(
           (Color) o); // paintBackground(g,(Color)o); /*super.setBackground((Color)o) ;*/
       break;
     case setComposite:
       g.setComposite((Composite) o);
       break;
     case setPaint:
       g.setPaint((Paint) o);
       break;
     case setRenderingHint:
       g.setRenderingHint((RenderingHints.Key) o1, o2);
       break;
     case setRenderingHints:
       g.setRenderingHints((Map<?, ?>) o);
       break;
     case setStroke:
       g.setStroke((Stroke) o);
       break;
     case setTransform:
       g.setTransform(makeTransform(o));
       break;
     case shear:
       g.shear((Double) o1, (Double) o2);
       break;
     case transform1:
       g.transform(makeTransform(o));
       break;
     case translate1:
       g.translate((Double) o1, (Double) o2);
       break;
     case translate2:
       g.translate((Integer) o1, (Integer) o2);
       break;
     case clearRect:
       g.clearRect((Integer) o1, (Integer) o2, (Integer) o3, (Integer) o4);
       break;
     case copyArea:
       g.copyArea(
           (Integer) o1, (Integer) o2, (Integer) o3, (Integer) o4, (Integer) o5, (Integer) o6);
       break;
     case drawArc:
       g.drawArc(
           (Integer) o1, (Integer) o2, (Integer) o3, (Integer) o4, (Integer) o5, (Integer) o6);
       break;
     case drawBytes:
       g.drawBytes((byte[]) o1, (Integer) o2, (Integer) o3, (Integer) o4, (Integer) o5);
       break;
     case drawChars:
       g.drawChars((char[]) o1, (Integer) o2, (Integer) o3, (Integer) o4, (Integer) o5);
       break;
     case drawImage4:
       g.drawImage((Image) o1, (Integer) o2, (Integer) o3, (Color) o4, (ImageObserver) o5);
       break;
     case drawImage5:
       g.drawImage((Image) o1, (Integer) o2, (Integer) o3, (ImageObserver) o4);
       break;
     case drawImage6:
       g.drawImage(
           (Image) o1,
           (Integer) o2,
           (Integer) o3,
           (Integer) o4,
           (Integer) o5,
           (Color) o6,
           (ImageObserver) o7);
       break;
     case drawImage7:
       g.drawImage(
           (Image) o1, (Integer) o2, (Integer) o3, (Integer) o4, (Integer) o5, (ImageObserver) o6);
       break;
     case drawImage8:
       g.drawImage(
           (Image) o1,
           (Integer) o2,
           (Integer) o3,
           (Integer) o4,
           (Integer) o5,
           (Integer) o6,
           (Integer) o7,
           (Integer) o8,
           (Integer) o9,
           (Color) o10,
           (ImageObserver) o11);
       break;
     case drawImage9:
       g.drawImage(
           (Image) o1,
           (Integer) o2,
           (Integer) o3,
           (Integer) o4,
           (Integer) o5,
           (Integer) o6,
           (Integer) o7,
           (Integer) o8,
           (Integer) o9,
           (ImageObserver) o10);
       break;
     case drawLine:
       g.drawLine((Integer) o1, (Integer) o2, (Integer) o3, (Integer) o4);
       break;
     case drawOval:
       g.drawOval((Integer) o1, (Integer) o2, (Integer) o3, (Integer) o4);
       break;
     case drawPolygon1:
       g.drawPolygon((int[]) o1, (int[]) o2, (Integer) o3);
       break;
     case drawPolygon2:
       g.drawPolygon((Polygon) o);
       break;
     case drawPolyline:
       g.drawPolyline((int[]) o1, (int[]) o2, (Integer) o3);
       break;
     case drawRect:
       g.drawRect((Integer) o1, (Integer) o2, (Integer) o3, (Integer) o4);
       break;
     case drawRoundRect:
       g.drawRoundRect(
           (Integer) o1, (Integer) o2, (Integer) o3, (Integer) o4, (Integer) o5, (Integer) o6);
       break;
     case fillArc:
       g.fillArc(
           (Integer) o1, (Integer) o2, (Integer) o3, (Integer) o4, (Integer) o5, (Integer) o6);
       break;
     case fillOval:
       g.fillOval((Integer) o1, (Integer) o2, (Integer) o3, (Integer) o4);
       break;
       // {toBuffer("fillPolygon",mkArg(xPoints,  yPoints, nPoints) );}
     case fillPolygon1:
       g.fillPolygon((int[]) o1, (int[]) o2, (Integer) o3);
       break;
     case fillPolygon2:
       g.fillPolygon((Polygon) o);
       break;
     case fillRect:
       g.fillRect((Integer) o1, (Integer) o2, (Integer) o3, (Integer) o4);
       break;
     case fillRoundRect:
       g.fillRoundRect(
           (Integer) o1, (Integer) o2, (Integer) o3, (Integer) o4, (Integer) o5, (Integer) o6);
       break;
     case setClip1:
       g.setClip((Shape) o);
       break;
     case setColor:
       g.setColor((Color) o);
       break;
     case setFont:
       g.setFont((Font) o);
       break;
     case setPaintMode:
       g.setPaintMode();
       break;
     case setXORMode:
       g.setXORMode((Color) o);
       break;
     case opaque:
       super.setOpaque((Boolean) o);
       break;
     case drawOutline: // g.drawString((String)o1, (Integer)o2, (Integer)o3) ;break;
       {
         FontRenderContext frc = g.getFontRenderContext();
         TextLayout tl = new TextLayout((String) o1, g.getFont(), frc);
         Shape s1 = tl.getOutline(null);
         AffineTransform af = g.getTransform();
         g.translate((Integer) o2, (Integer) o3);
         g.draw(s1);
         g.setTransform(af);
       }
       ;
       break;
     default:
       System.out.println("Unknown image operation " + s);
   }
 }