private void placerPostes(Graphics2D g) {
   g.setStroke(new BasicStroke());
   for (PlanSalle.Poste poste : modele.listerPostes()) {
     g.setColor(Color.gray);
     int xPoste = Parametres.posteX(poste.getPosition().getTravee(), poste.getOrientation());
     int yPoste = Parametres.posteY(poste.getPosition().getRangee(), poste.getOrientation());
     int xPersonne =
         Parametres.personneX(poste.getPosition().getTravee(), poste.getOrientation());
     int yPersonne =
         Parametres.personneY(poste.getPosition().getRangee(), poste.getOrientation());
     if (poste.getOrientation() == Orientation.NORD
         || poste.getOrientation() == Orientation.SUD) {
       g.fill3DRect(xPoste, yPoste, Parametres.LONGUEUR_POSTE, Parametres.LARGEUR_POSTE, true);
     } else {
       g.fill3DRect(xPoste, yPoste, Parametres.LARGEUR_POSTE, Parametres.LONGUEUR_POSTE, true);
     }
     g.drawOval(xPersonne, yPersonne, Parametres.LARGEUR_PERSONNE, Parametres.LARGEUR_PERSONNE);
     if (poste.peutVoir()) {
       g.setColor(Color.red);
     } else {
       g.setColor(Color.blue);
     }
     g.fillOval(xPersonne, yPersonne, 20, 20);
   }
 }
Example #2
0
  public void StaticObjNew(StaticObj so) {
    Graphics2D g = radarArea.backImage.createGraphics();
    g.setColor(so_color);

    if (so instanceof Beacon) {
      g.drawOval(
          convPos(so.pos.x) - grid_size / 6,
          convPos(so.pos.y) - grid_size / 6,
          grid_size / 3,
          grid_size / 3);
      JLabel sol = new JLabel(Integer.toString(so.id));
      sol.setForeground(so_text_color);
      sol.setBounds(
          convPos(so.pos.x) + grid_size / 6, convPos(so.pos.y), grid_size / 3, grid_size / 2);
      radarArea.add(sol, new Integer(1));
    }

    if (so instanceof Airfield) {
      int xa[] = new int[3], ya[] = new int[3];
      int l1 = grid_size / 2, l2 = grid_size / 6;
      xa[0] = convPos(so.pos.x);
      ya[0] = convPos(so.pos.y);
      xa[1] = convPos(so.pos.x) - l1 * so.dir.x - l2 * so.dir.y;
      ya[1] = convPos(so.pos.y) - l1 * so.dir.y + l2 * so.dir.x;
      xa[2] = convPos(so.pos.x) - l1 * so.dir.x + l2 * so.dir.y;
      ya[2] = convPos(so.pos.y) - l1 * so.dir.y - l2 * so.dir.x;
      g.drawPolygon(xa, ya, 3);
      JLabel sol = new JLabel(Integer.toString(so.id));
      sol.setForeground(so_text_color);
      sol.setBounds(
          convPos(so.pos.x) + grid_size / 6, convPos(so.pos.y), grid_size / 3, grid_size / 2);
      radarArea.add(sol, new Integer(1));
    }

    if (so instanceof Exit) {
      g.drawRect(
          convPos(so.pos.x) - grid_size / 6,
          convPos(so.pos.y) - grid_size / 6,
          grid_size / 3,
          grid_size / 3);
      JLabel sol = new JLabel(Integer.toString(so.id));
      sol.setForeground(so_text_color);
      sol.setBounds(
          convPos(so.pos.x) + grid_size / 6, convPos(so.pos.y), grid_size / 3, grid_size / 2);
      radarArea.add(sol, new Integer(1));
    }

    if (so instanceof Line) {
      g.setColor(line_color);
      g.drawLine(
          convPos(((Line) so).pos.x),
          convPos(((Line) so).pos.y),
          convPos(((Line) so).second_end.x),
          convPos(((Line) so).second_end.y));
    }

    radarArea.backIcon = new ImageIcon(radarArea.backImage);
    radarArea.back.setIcon(radarArea.backIcon);
  }
Example #3
0
  /** PaintComponent to draw everything. */
  @Override
  public void paintComponent(Graphics g) {
    super.paintComponent(g);
    setBackground(Color.WHITE);
    // If using images, use cool dragon background
    if (useImages) g.drawImage(background, 0, 0, 310, 300, null);

    // Use light gray to not overpower the background image
    g.setColor(Color.LIGHT_GRAY);
    for (int y = 1; y < ROWS; ++y)
      g.fillRoundRect(0, cellSize * y - 4, (cellSize * COLS) - 1, 8, 8, 8);
    for (int x = 1; x < COLS; ++x)
      g.fillRoundRect(cellSize * x - 4, 0, 8, (cellSize * ROWS) - 1, 8, 8);

    // Use graphics2d for when not using the images
    Graphics2D g2d = (Graphics2D) g;
    g2d.setStroke(new BasicStroke(4, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
    for (int y = 0; y < ROWS; ++y) {
      for (int x = 0; x < COLS; ++x) {
        int x1 = x * cellSize + 16;
        int y1 = y * cellSize + 16;
        if (board[y][x] == Symbol.X) {
          // use image if set to true, otherwise use g2d
          // for thicker, better looking X's and O's
          if (useImages) g.drawImage(imageX, x1, y1, 75, 75, null);
          else {
            g2d.setColor(PURPLE);
            int x2 = (x + 1) * cellSize - 16;
            int y2 = (y + 1) * cellSize - 16;
            g2d.drawLine(x1, y1, x2, y2);
            g2d.drawLine(x2, y1, x1, y2);
          }
        } else if (board[y][x] == Symbol.O) {
          if (useImages) g.drawImage(imageO, x1, y1, 75, 75, null);
          else {
            g2d.setColor(Color.BLUE);
            g2d.drawOval(x1, y1, 70, 70);
          }
        }
      } // end for
    }

    // Set status bar based on gamestate.  If CONTINUE, show whose turn it is
    if (gameStatus == GameStatus.CONTINUE) {
      statusBar.setForeground(Color.BLACK);
      if (currentPlayer == Symbol.X) statusBar.setText("X's Turn");
      else statusBar.setText("O's Turn");
    } else if (gameStatus == GameStatus.DRAW) {
      statusBar.setForeground(Color.RED);
      statusBar.setText("Draw! Click to play again!");
    } else if (gameStatus == GameStatus.X_WIN) {
      statusBar.setForeground(Color.RED);
      statusBar.setText("X has won! Click to play again!");
    } else if (gameStatus == GameStatus.O_WIN) {
      statusBar.setForeground(Color.RED);
      statusBar.setText("O has won! Click to play again!");
    }
  }
Example #4
0
 void drawCircleFrom(Graphics2D g, int fx, int fy, int tx, int ty, Color color, int size) {
   Color col = g.getColor();
   g.setColor(color);
   int x, y;
   if (fx == tx) { // vertical line
     x = fx;
     if (ty > fy) y = fy + size / 2;
     else y = fy - size / 2;
   } else { // assume horizontal for now
     y = fy;
     if (tx > fx) x = fx + size / 2;
     else x = fx - size / 2;
   }
   // x and y are the centre of the circle
   // adjust to top left corner
   x -= size / 2;
   y -= size / 2;
   g.drawOval(x, y, size, size);
   g.fillOval(x, y, size, size);
   g.setColor(col);
 }
Example #5
0
  void drawCircleTo(Graphics2D g, int fx, int fy, int tx, int ty, Color color, int size) {
    Color col = g.getColor();
    g.setColor(color);
    int x, y;
    x = tx;
    y = ty;
    if (color == Color.BLUE) {
      if (fx == tx) { // vertical line
        if (ty > fy) y = ty - size / 2;
        else y = ty + size / 2;
      } else {
        if (tx > fx) x = tx - size / 2;
        else x = tx + size / 2;
      }
    }
    // x and y are the centre of the circle
    // adjust to top left corner

    x -= size / 2;
    y -= size / 2;
    g.drawOval(x, y, size, size);
    g.fillOval(x, y, size, size);
    g.setColor(col);
  }
Example #6
0
  void draw(Graphics2D g) {

    int endX, endY;
    Block from = null;
    if (fromId > -1) from = diag.blocks.get(new Integer(fromId));
    Block to = null;
    if (!endsAtLine && toId > -1) to = diag.blocks.get(new Integer(toId));

    if (toX == -1) endX = diag.xa;
    else endX = toX;

    if (toY == -1) endY = diag.ya;
    else endY = toY;

    g.setColor(Color.GRAY);

    Stroke stroke = g.getStroke();
    ZigzagStroke zzstroke = new ZigzagStroke(stroke, 2, 4);

    if (toX == -1) {
      g.drawRect(fromX - 3, fromY - 3, 6, 6);
      return;
    }

    if (from != null) {
      if (fromSide == Side.TOP) fromY = from.cy - from.height / 2;
      else if (fromSide == Side.BOTTOM) fromY = from.cy + from.height / 2;
      else if (fromSide == Side.LEFT) fromX = from.cx - from.width / 2;
      else if (fromSide == Side.RIGHT) fromX = from.cx + from.width / 2;
    }

    if (to != null) {
      if (toSide == Side.TOP) toY = to.cy - to.height / 2;
      else if (toSide == Side.BOTTOM) toY = to.cy + to.height / 2;
      else if (toSide == Side.LEFT) toX = to.cx - to.width / 2;
      else if (toSide == Side.RIGHT) toX = to.cx + to.width / 2;
    }

    if (driver.selArrowP == this) g.setColor(Color.BLUE);
    else if ((from instanceof ComponentBlock
            || from instanceof ExtPortBlock
            || from instanceof Enclosure)
        && (to instanceof ComponentBlock
            || to instanceof ExtPortBlock
            || to instanceof Enclosure
            || endsAtLine))
      if (checkStatus == Status.UNCHECKED) g.setColor(Color.BLACK);
      else if (checkStatus == Status.COMPATIBLE) g.setColor(FOREST_GREEN);
      else g.setColor(ORANGE_RED);
    else if (from instanceof LegendBlock || to instanceof LegendBlock) g.setColor(Color.GRAY);

    int fx, fy, tx, ty;
    fx = fromX;
    fy = fromY;
    // tx = toX;
    // ty = toY;
    // int autoX = -1, autoY = -1;  // only used for automatic ports
    if (bends != null) {
      for (Bend bend : bends) {
        tx = bend.x;
        ty = bend.y;
        if (!dropOldest) g.drawLine(fx, fy, tx, ty);
        else {
          Shape shape = new Line2D.Double(fx, fy, tx, ty);
          shape = zzstroke.createStrokedShape(shape);
          g.draw(shape);
          // g.setStroke(stroke);
        }

        if (bend.marked) {
          Color col = g.getColor();
          g.setColor(Color.RED);
          g.drawOval(tx - 5, ty - 5, 10, 10);
          g.setColor(col);
        }
        calcLimits(fx, tx, fy, ty);
        fx = tx;
        fy = ty;
      }
    }
    tx = endX;
    ty = endY;

    int x = endX;
    if (to != null && endsAtBlock && to.multiplex) {
      String s = to.mpxfactor;
      if (s == null) s = " ";
      int i = s.length() * driver.fontWidth + 10;
      x -= i;
    }

    if (headMarked) {
      Color col = g.getColor();
      g.setColor(Color.RED);
      g.drawOval(x - 5, toY - 5, 10, 10);
      g.setColor(col);
    }

    if (!dropOldest) g.drawLine(fx, fy, tx, ty);
    else {
      Shape shape = new Line2D.Double(fx, fy, tx, ty);
      shape = zzstroke.createStrokedShape(shape);
      g.draw(shape);
      // g.setStroke(stroke);
    }

    if (tailMarked) {
      Color col = g.getColor();
      g.setColor(Color.RED);
      g.drawOval(fromX - 5, fromY - 5, 10, 10);
      g.setColor(col);
    }

    calcLimits(fx, x, fy, toY);

    if (!endsAtBlock && !endsAtLine) {
      g.drawRect(fromX - 3, fromY - 3, 6, 6);
      g.drawRect(x - 3, toY - 3, 6, 6);
    } else if (endsAtBlock) {
      if ((from instanceof ComponentBlock
              || from instanceof ExtPortBlock
              || from instanceof Enclosure)
          && (to instanceof ComponentBlock
              || to instanceof ExtPortBlock
              || to instanceof Enclosure)) {
        Arrowhead ah = new Arrowhead(fx, fy, toX, toY);
        ah.draw(g);
      }

    } else if (endsAtLine) {
      drawCircleTo(g, fx, fy, x, toY, Color.BLACK, 4);
      // g.drawOval(toX - 2, toY - 2, 4, 4);
      // g.fillOval(toX - 2, toY - 2, 4, 4);
    }

    if (toX != -1 && (endsAtBlock || endsAtLine)) {
      if (upStreamPort != null && (from instanceof ComponentBlock || from instanceof Enclosure)) {
        if (upStreamPort.equals("*")) {
          drawCircleFrom(g, fromX, fromY, endX, endY, Color.BLUE, 8);
          // g.setColor(Color.BLUE);
          // g.drawOval(fromX, fromY - 4, 8, 8);
          // g.fillOval(fromX, fromY - 4, 8, 8);
        } else if (from.visible) {
          g.setColor(Color.BLUE);
          int y = fromY + driver.fontHeight;
          int x2 = fromX + driver.fontWidth;
          g.drawString(upStreamPort, x2, y);
        }
        g.setColor(Color.BLACK);
      }
      if (downStreamPort != null
          && !endsAtLine
          && to != null
          && (to instanceof ComponentBlock || to instanceof Enclosure)) {
        if (downStreamPort.equals("*")) {
          drawCircleTo(g, fx, fy, toX, toY, Color.BLUE, 8);
          // g.setColor(Color.BLUE);
          // g.drawOval(x - 8, toY - 4, 8, 8);
          // g.fillOval(x - 8, toY - 4, 8, 8);
        } else if (to.visible) {
          g.setColor(Color.BLUE);
          int y = toY - driver.fontHeight / 2;
          x = toX - driver.fontWidth * (downStreamPort.length() + 1);
          if (!endsAtLine && to != null && to.multiplex) x -= 20;
          g.drawString(downStreamPort, x, y);
        }
        g.setColor(Color.BLACK);
      }
    }
    if (extraArrowhead != null) extraArrowhead.draw(g);
  }
 private void drawCircle(int pix, int xCenter, int yCenter, int r) {
   Graphics2D g = res.createGraphics();
   g.setColor(Color.RED);
   g.drawOval(xCenter - r, yCenter - r, r * 2, r * 2);
   g.dispose();
 }
  public void paint(Graphics g) {
    Graphics2D graph = (Graphics2D) g;
    graph.setStroke(drawingStroke);
    graph.setPaint(Color.red);
    graph.draw(xAxis);
    graph.setPaint(Color.BLACK);
    graph.drawString("X", xStopHoriz + 10, yOnxAxis + 4);
    graph.setPaint(Color.red);
    graph.draw(yAxis);
    graph.setPaint(Color.BLACK);
    graph.drawString("Y", xOnyAxis - 4, yStartVert - 10);
    graph.setColor(Color.BLACK);
    graph.drawString("Graph for y= " + function, 150, 50);
    graph.drawString("Hold down the mouse click to read a corresponding curve y-value ", 15, 12);

    int xBump = (int) xAxisLength / (numberOfXs - 1);
    int xOffset = xStartHoriz;
    int[] xOffsets = new int[numberOfXs];

    int yBump = (int) yAxisLength / (numberOfExpressions - 1);
    int yOffset = yStopVert;
    int[] yOffsets = new int[numberOfExpressions];

    float[] yScaleValues = new float[numberOfExpressions];
    String[] yScaleStrings = new String[numberOfExpressions];

    float smallestYvalue = ordinates[0];
    float biggestYvalue = ordinates[0];

    for (int i = 0; i < numberOfXs; i++) {
      xOffsets[i] = xOffset;
      graph.drawString("|", xOffset - 2, yOnxAxis + 5);
      graph.drawString(abscissaeStrings[i], xOffset - 5, yOnxAxis + 25);
      xOffset += xBump;
    }

    // Determinate the biggest and the smallest y value
    for (float yValue : ordinates) {
      if (yValue > biggestYvalue) biggestYvalue = yValue;
      if (yValue < smallestYvalue) smallestYvalue = yValue;
    }

    yScaleValues[0] = smallestYvalue;
    yScaleStrings[0] = String.valueOf(smallestYvalue);

    float yScaleIncrement = (biggestYvalue - smallestYvalue) / numberOfExpressions;

    for (int i = 1;
        i < yScaleValues.length;
        i++) // Start at [1] because [0] contains the smallest value
    {
      yScaleValues[i] = (yScaleValues[(i - 1)] + yScaleIncrement);
      yScaleStrings[i] =
          String.format("%.01f", yScaleValues[i]); // To make the labels look neat by...
      // ...limiting the values to 2 decimal points
    }

    for (int i = 0; i < numberOfExpressions; i++) {
      yOffsets[i] = yOffset;
      graph.drawString("--", xOnyAxis - 5, yOffset + 2);

      if (!functionIsNotConstant)
        graph.drawString(yScaleStrings[0], 30, yOffset + 2); // Label only one y coordinate
      else {
        graph.drawString(yScaleStrings[i], 30, yOffset + 2); // Label all applicable y coordinates
        yOffset -= yBump;
      }
    }
    // ==================Drawing the curve======================
    int[] yPixelRelatives = new int[numberOfExpressions];
    double yValueRange = biggestYvalue - smallestYvalue;
    int yPixelRange = (int) yAxisLength;

    // Converting expression values into pixel values
    for (int i = 0; i < numberOfExpressions; i++) {
      double yValuePercent = (double) ((ordinates[i] - smallestYvalue) / yValueRange);
      int yPixelAbsolute = (int) (yPixelRange * yValuePercent);
      yPixelRelatives[i] = (yStopVert - yPixelAbsolute);
    }
    graph.setColor(Color.BLUE);
    for (int i = 0; i < yPixelRelatives.length; i++) {
      graph.drawOval(xOffsets[i] - 2, yPixelRelatives[i] - 2, 4, 4);

      if (i > 0)
        graph.drawLine(
            xOffsets[(i - 1)], yPixelRelatives[(i - 1)], xOffsets[i], yPixelRelatives[i]);
    }
  }
  private void drawPlot(Graphics g) {
    Graphics2D g2d = (Graphics2D) g;
    g2d.setRenderingHint(
        RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
    g2d.setColor(Color.white);
    g2d.fillRect(0, 0, getWidth(), getHeight());

    double activeWidth = getWidth() - leftMargin - rightMargin;
    double activeHeight = getHeight() - topMargin - bottomMargin;
    int bottomY = getHeight() - bottomMargin;
    int rightX = getWidth() - rightMargin;

    // draw data line
    int x1, x2, y1, y2;
    g2d.setColor(Color.red);
    for (int i = 1; i < numComponents; i++) {
      x1 = (int) (leftMargin + ((double) (i - 1) / (numComponents - 1)) * activeWidth);
      y1 = (int) (bottomY - (plotData[i - 1][plotIndex] * 10.0) / 1000 * activeHeight);
      x2 = (int) (leftMargin + ((double) (i) / (numComponents - 1)) * activeWidth);
      y2 = (int) (bottomY - (plotData[i][plotIndex] * 10) / 1000 * activeHeight);
      g2d.drawLine(x1, y1, x2, y2);
    }

    // draw data points
    int radius = 2;
    for (int i = 0; i < numComponents; i++) {
      x1 = (int) (leftMargin + ((double) (i) / (numComponents - 1)) * activeWidth);
      y1 = (int) (bottomY - (plotData[i][plotIndex] * 10.0) / 1000 * activeHeight);
      g2d.drawOval(x1 - radius - 1, y1 - radius - 1, 2 * radius + 2, 2 * radius + 2);
    }

    // draw axes
    g2d.setColor(Color.black);
    g2d.drawLine(leftMargin, bottomY, rightX, bottomY);
    g2d.drawLine(leftMargin, bottomY, leftMargin, topMargin);
    g2d.drawLine(leftMargin, topMargin, rightX, topMargin);
    g2d.drawLine(rightX, bottomY, rightX, topMargin);

    // draw ticks
    int tickSize = 4;
    for (int i = 1; i <= numComponents; i++) {
      x1 = (int) (leftMargin + ((double) (i - 1) / (numComponents - 1)) * activeWidth);
      g2d.drawLine(x1, bottomY, x1, bottomY + tickSize);
    }

    for (int i = 0; i <= 1000; i += 100) {
      y1 = (int) (bottomY - i / 1000.0 * activeHeight);
      g2d.drawLine(leftMargin, y1, leftMargin - tickSize, y1);
    }

    // labels
    DecimalFormat df = new DecimalFormat("#,###,###.###");
    Font font = new Font("SanSerif", Font.PLAIN, 11);
    FontMetrics metrics = g.getFontMetrics(font);
    int hgt, adv;
    hgt = metrics.getHeight();

    // x-axis labels
    String label;
    for (int i = 1; i <= numComponents; i++) {
      label = String.valueOf(i);
      x1 = (int) (leftMargin + ((double) (i - 1) / (numComponents - 1)) * activeWidth);
      adv = metrics.stringWidth(label) / 2;
      g2d.drawString(label, x1 - adv, bottomY + hgt + 4);
    }
    label = "Component";
    adv = metrics.stringWidth(label);
    int xAxisMidPoint = (int) (leftMargin + activeWidth / 2);
    g2d.drawString(label, xAxisMidPoint - adv / 2, bottomY + 2 * hgt + 6);

    // y-axis labels

    // rotate the font
    Font oldFont = g.getFont();
    Font f = oldFont.deriveFont(AffineTransform.getRotateInstance(-Math.PI / 2.0));
    g2d.setFont(f);

    int yAxisMidPoint = (int) (topMargin + activeHeight / 2);
    int offset;
    label = "Explained Variance (%)";
    offset = metrics.stringWidth("100.0") + 12 + hgt;
    adv = metrics.stringWidth(label);
    g2d.drawString(label, leftMargin - offset, yAxisMidPoint + adv / 2);

    // replace the rotated font.
    g2d.setFont(oldFont);

    df = new DecimalFormat("0.0");
    for (int i = 0; i <= 1000; i += 100) {
      label = df.format(i / 10);
      y1 = (int) (bottomY - i / 1000.0 * activeHeight);
      adv = metrics.stringWidth(label);
      g2d.drawString(label, leftMargin - adv - 12, y1 + hgt / 2);
    }

    // title

    // bold font
    oldFont = g.getFont();
    font = font = new Font("SanSerif", Font.BOLD, 12);
    g2d.setFont(font);

    label = "PCA Scree Plot";
    adv = metrics.stringWidth(label);
    g2d.drawString(label, getWidth() / 2 - adv / 2, topMargin - hgt - 5);

    g2d.setFont(oldFont);
  }
Example #10
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);
   }
 }