예제 #1
0
  public void paint(Graphics g) {
    super.paint(g);

    Graphics2D g2 = (Graphics2D) g;
    int size =
        Math.min(
            MAX_SIZE,
            Math.min(
                getWidth() - imagePadding.left - imagePadding.right,
                getHeight() - imagePadding.top - imagePadding.bottom));

    g2.translate(getWidth() / 2 - size / 2, getHeight() / 2 - size / 2);
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    Shape shape;

    if (mode == ColorPicker.SAT || mode == ColorPicker.BRI) {
      shape = new Ellipse2D.Float(0, 0, size, size);
    } else {
      Rectangle r = new Rectangle(0, 0, size, size);
      shape = r;
    }

    if (hasFocus()) {
      PaintUtils.paintFocus(g2, shape, 5);
    }

    if (!(shape instanceof Rectangle)) {
      // paint a circular shadow
      g2.translate(2, 2);
      g2.setColor(new Color(0, 0, 0, 20));
      g2.fill(new Ellipse2D.Float(-2, -2, size + 4, size + 4));
      g2.setColor(new Color(0, 0, 0, 40));
      g2.fill(new Ellipse2D.Float(-1, -1, size + 2, size + 2));
      g2.setColor(new Color(0, 0, 0, 80));
      g2.fill(new Ellipse2D.Float(0, 0, size, size));
      g2.translate(-2, -2);
    }

    g2.drawImage(image, 0, 0, size, size, 0, 0, size, size, null);

    if (shape instanceof Rectangle) {
      Rectangle r = (Rectangle) shape;
      PaintUtils.drawBevel(g2, r);
    } else {
      g2.setColor(new Color(0, 0, 0, 120));
      g2.draw(shape);
    }

    g2.setColor(Color.white);
    g2.setStroke(new BasicStroke(1));
    g2.draw(new Ellipse2D.Float(point.x - 3, point.y - 3, 6, 6));
    g2.setColor(Color.black);
    g2.draw(new Ellipse2D.Float(point.x - 4, point.y - 4, 8, 8));

    g.translate(-imagePadding.left, -imagePadding.top);
  }
예제 #2
0
  public void drawStar(int xpos, int ypos, double rot, double xscale, double yscale) {
    g.translate(xpos, ypos);
    g.rotate(rot * Math.PI / 180.0);
    g.scale(xscale, yscale);

    g.fillOval(-10, -10, 20, 20);

    g.scale(1.0 / xscale, 1.0 / yscale);
    g.rotate(-rot * Math.PI / 180.0);
    g.translate(-xpos, -ypos);
  }
 @Override
 public void paintIcon(Component c, Graphics g, int x, int y) {
   icon.paintIcon(c, g, x, y);
   int w = getIconWidth();
   int h = getIconHeight();
   Graphics2D g2 = (Graphics2D) g;
   g2.setPaint(FOREGROUND);
   g2.translate(x, y);
   g2.fillRect(a, (h - b) / 2, w - a - a, b);
   g2.translate(-x, -y);
 }
예제 #4
0
  public void drawCircle(int xpos, int ypos, double rot, double xscale, double yscale, int width) {
    g.translate(xpos, ypos);
    g.rotate(rot * Math.PI / 180.0);
    g.scale(xscale, yscale);

    g.fillOval(-width / 2, -width / 2, width, width);

    g.scale(1.0 / xscale, 1.0 / yscale);
    g.rotate(-rot * Math.PI / 180.0);
    g.translate(-xpos, -ypos);
  }
예제 #5
0
  public void drawRocket(
      Image image, int xpos, int ypos, double rot, double xscale, double yscale) {
    int width = rocketImage.getWidth(this);
    int height = rocketImage.getHeight(this);
    g.translate(xpos, ypos);
    g.rotate(rot * Math.PI / 180.0);
    g.scale(xscale, yscale);

    g.drawImage(image, -width / 2, -height / 2, width, height, this);

    g.scale(1.0 / xscale, 1.0 / yscale);
    g.rotate(-rot * Math.PI / 180.0);
    g.translate(-xpos, -ypos);
  }
예제 #6
0
 protected void drawString(Graphics2D g2, double x, double y, double theta) {
   // Transform to the requested location.
   g2.translate(x, y);
   // Rotate by the requested angle.
   g2.rotate(theta);
   // Draw the first part of the string.
   String first = mMessage.substring(0, mSplit);
   float width = drawBoxedString(g2, first, Color.white, Color.red, 0);
   // Draw the second part of the string.
   String second = mMessage.substring(mSplit);
   drawBoxedString(g2, second, Color.blue, Color.white, width);
   // Undo the transformations.
   g2.rotate(-theta);
   g2.translate(-x, -y);
 }
    public void paintComponent(Graphics g) {
      super.paintComponent(g);

      Graphics2D g2 = (Graphics2D) g;

      if (!text.equals("")) {
        g2.translate(0, getSize().getHeight());
        g2.rotate(-Math.PI / 2);
        g2.setColor(Color.black);
        g2.drawString(text, 20, 14);

        g2.translate(0, -getSize().getHeight());
        g2.transform(AffineTransform.getQuadrantRotateInstance(1));
      }
    }
예제 #8
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();
  }
예제 #9
0
  protected void paintComponent(Graphics g2) {
    super.paintComponent(g2);

    Graphics2D g = (Graphics2D) g2;
    test.draw(g2, 0, 0);
    // Shape triangle = new Polygon(new int[] {15, 20, 10}, new int[] {0, 10, 10}, 3);

    Shape square = new Rectangle2D.Double(0, 0, 30, 30);

    g.setColor(Color.white);

    g.translate(20, 20);
    // g.rotate(theta, 10, 10);
    // g.fill(star);

    // g.setColor(new Color(0, 86, 141));
    // g.fill(square);
    if (star2 != null) g.fill(star2);

    // Graphics2D g3 = (Graphics2D) g;
    // 3.fill(star);

    // g.setStroke(new BasicStroke(1));
    // g.translate(x, y);
    // g.draw(line);
    // g.draw(line2);

  }
  @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;
  }
예제 #11
0
  /**
   * Override the pain method do draw the axis lines
   *
   * @param g The graphics to paint to
   */
  public void paint(Graphics g) {
    Rectangle b = getBounds();
    g.setColor(canvasBg);
    g.fillRect(0, 0, b.width, b.height);
    paintGrid(g);

    Point center = getCenter();
    if (g instanceof Graphics2D) {
      ((Graphics2D) g).translate(center.x, center.y);
    }
    super.paint(g);
    if (g instanceof Graphics2D) {
      ((Graphics2D) g).scale(1.0, 1.0);
    }
    g.setColor(Color.gray);
    g.drawLine(0, -10 * b.height, 0, 10 * b.height);
    g.drawLine(-10 * b.width, 0, 10 * b.width, 0);

    MetSymbol tmp = highlightedMetSymbol;
    if (tmp != null) {
      Rectangle tb = tmp.getBounds();
      g.setColor(Color.red);
      g.drawRect(tb.x - 2, tb.y - 2, tb.width + 4, tb.height + 4);
    }
  }
예제 #12
0
 public void paint(Graphics g) {
   if (loadflag && (!runflag)) {
     g.clearRect(0, 0, 530, 330);
     Graphics2D g2D = (Graphics2D) g;
     g2D.translate(0, 50); // 设置图像左上角为当前点
     g.drawImage(iImage, 0, 0, null); // 画输入图        	
   }
 }
예제 #13
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;
    }
예제 #14
0
 @Override
 public void paintIcon(Component c, Graphics g, int x, int y) {
   Graphics2D g2 = (Graphics2D) g.create();
   g2.translate(x, y);
   g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
   g2.setPaint(Color.ORANGE);
   g2.fill(star);
   g2.dispose();
 }
  /**
   * Draw the icon at the specified location. Paints this component as an icon.
   *
   * @param c the component which can be used as observer
   * @param g the <tt>Graphics</tt> object used for painting
   * @param x the position on the X coordinate
   * @param y the position on the Y coordinate
   */
  public void paintIcon(Component c, Graphics g, int x, int y) {
    g = g.create();
    try {
      Graphics2D g2 = (Graphics2D) g;
      AntialiasingManager.activateAntialiasing(g2);

      g2.setColor(Color.WHITE);
      g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.8f));
      g2.fillRoundRect(x, y, getIconWidth() - 1, getIconHeight() - 1, 10, 10);
      g2.setColor(Color.DARK_GRAY);
      g2.drawRoundRect(x, y, getIconWidth() - 1, getIconHeight() - 1, 10, 10);

      // Indent component content from the border.
      g2.translate(x + 5, y + 5);

      super.paint(g2);

      g2.translate(x, y);
    } finally {
      g.dispose();
    }
  }
예제 #16
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;
 }
예제 #17
0
 public void paint(Graphics g, Shape a) {
   Graphics2D g2 = (Graphics2D) g;
   Rectangle2D abounds = a.getBounds2D();
   AffineTransform saveTransform = g2.getTransform();
   Paint savePaint = g2.getPaint();
   try {
     g2.translate(abounds.getX() - bounds.getX(), abounds.getY() - bounds.getY());
     g2.setPaint(Color.BLACK); // FIXME
     p.paint(g2);
   } finally {
     g2.setTransform(saveTransform);
     g2.setPaint(savePaint);
   }
 }
예제 #18
0
 public void paint(Graphics g1) {
   Graphics2D g = (Graphics2D) g1;
   Component c;
   Point p;
   paintComponent(g);
   for (int i = 0; i < getComponentCount(); i++) {
     AffineTransform save = g.getTransform();
     c = getComponent(i);
     p = c.getLocation();
     g.translate((int) p.getX(), (int) p.getY());
     c.paint(g);
     g.setTransform(save);
   }
 }
예제 #19
0
 @Override
 protected void paintComponent(Graphics g) {
   super.paintComponent(g);
   Graphics2D g2 = (Graphics2D) g.create();
   if (getModel().isPressed()) {
     g2.translate(1, 1);
   }
   g2.setStroke(new BasicStroke(2));
   g2.setColor(Color.BLACK);
   if (getModel().isRollover()) {
     g2.setColor(Color.WHITE);
   }
   int delta = 6;
   g2.drawLine(delta, delta, getWidth() - delta - 1, getHeight() - delta - 1);
   g2.drawLine(getWidth() - delta - 1, delta, delta, getHeight() - delta - 1);
   g2.dispose();
 }
예제 #20
0
 @Override
 public void paintIcon(Component c, Graphics g, int x, int y) {
   Graphics2D g2 = (Graphics2D) g.create();
   g2.setPaint(Objects.nonNull(c) ? c.getBackground() : Color.WHITE);
   g2.fillRect(x, y, getIconWidth(), getIconHeight());
   g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
   g2.setColor(ELLIPSE_COLOR);
   g2.translate(x, y);
   int size = list.size();
   for (int i = 0; i < size; i++) {
     float alpha = isRunning ? (i + 1) / (float) size : .5f;
     g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha));
     g2.fill(list.get(i));
   }
   // g2.translate(-x, -y);
   g2.dispose();
 }
예제 #21
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;
 }
예제 #22
0
  public void paint(Graphics g) {
    // repaint the whole transformer in case the view component was repainted
    Rectangle clipBounds = g.getClipBounds();
    if (clipBounds != null && !clipBounds.equals(visibleRect)) {
      repaint();
    }
    // clear the background
    g.setColor(getBackground());
    g.fillRect(0, 0, getWidth(), getHeight());

    if (view != null && at.getDeterminant() != 0) {
      Graphics2D g2 = (Graphics2D) g.create();
      Insets insets = getInsets();
      Rectangle bounds = getBounds();

      // don't forget about insets
      bounds.x += insets.left;
      bounds.y += insets.top;
      bounds.width -= insets.left + insets.right;
      bounds.height -= insets.top + insets.bottom;
      double centerX1 = bounds.getCenterX();
      double centerY1 = bounds.getCenterY();

      Rectangle tb = getTransformedSize();
      double centerX2 = tb.getCenterX();
      double centerY2 = tb.getCenterY();

      // set antialiasing by default
      g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
      if (renderingHints != null) {
        g2.addRenderingHints(renderingHints);
      }
      // translate it to the center of the view component again
      double tx = centerX1 - centerX2 - getX();
      double ty = centerY1 - centerY2 - getY();
      g2.translate((int) tx, (int) ty);
      g2.transform(at);
      view.paint(g2);
      g2.dispose();
    }
    // paint the border
    paintBorder(g);
  }
예제 #23
0
  @Override
  public void draw(Graphics2D g) {
    double opacity = get(OPACITY);
    opacity = Math.min(Math.max(0d, opacity), 1d);
    if (opacity != 0d) {
      if (opacity != 1d) {
        Rectangle2D.Double drawingArea = getDrawingArea();

        Rectangle2D clipBounds = g.getClipBounds();
        if (clipBounds != null) {
          Rectangle2D.intersect(drawingArea, clipBounds, drawingArea);
        }

        if (!drawingArea.isEmpty()) {

          BufferedImage buf =
              new BufferedImage(
                  (int) ((2 + drawingArea.width) * g.getTransform().getScaleX()),
                  (int) ((2 + drawingArea.height) * g.getTransform().getScaleY()),
                  BufferedImage.TYPE_INT_ARGB);
          Graphics2D gr = buf.createGraphics();
          gr.scale(g.getTransform().getScaleX(), g.getTransform().getScaleY());
          gr.translate((int) -drawingArea.x, (int) -drawingArea.y);
          gr.setRenderingHints(g.getRenderingHints());
          drawFigure(gr);
          gr.dispose();
          Composite savedComposite = g.getComposite();
          g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, (float) opacity));
          g.drawImage(
              buf,
              (int) drawingArea.x,
              (int) drawingArea.y,
              2 + (int) drawingArea.width,
              2 + (int) drawingArea.height,
              null);
          g.setComposite(savedComposite);
        }
      } else {
        drawFigure(g);
      }
    }
  }
예제 #24
0
  public synchronized void paint(Graphics graphics) {

    Graphics2D g = (Graphics2D) graphics;

    Image water = Toolkit.getDefaultToolkit().getImage("catanui/water.jpg");
    g.drawImage(water, 0, 0, this);

    for (Hex o : _hexes) {
      o.paint(g, _display_offset[0], _display_offset[1]);
    }

    g.translate(_display_offset[0] + 2, _display_offset[1] - 1);
    synchronized (portContents) {
      for (Pair c : portContents.keySet()) {

        int lowx =
            hexleft
                + (((CoordPair) c.getA()).getX() - (((CoordPair) c.getA()).getX() % 2))
                    / 2
                    * intervalSide[0]
                + (((CoordPair) c.getA()).getX() - (((CoordPair) c.getA()).getX() % 2))
                    / 2
                    * intervalSide[1]
                + (((CoordPair) c.getA()).getX() % 2) * intervalSide[0];
        int lowy = hextop + ((CoordPair) c.getA()).getY() * intervalUp;
        int highx =
            hexleft
                + (((CoordPair) c.getB()).getX() - (((CoordPair) c.getB()).getX() % 2))
                    / 2
                    * intervalSide[0]
                + (((CoordPair) c.getB()).getX() - (((CoordPair) c.getB()).getX() % 2))
                    / 2
                    * intervalSide[1]
                + (((CoordPair) c.getB()).getX() % 2) * intervalSide[0];
        int highy = hextop + ((CoordPair) c.getB()).getY() * intervalUp;

        int dx = highx - lowx;
        int dy = highy - lowy;
        double rad = Math.atan((1.0) * dy / dx);

        if (dx < 0) rad += Math.PI;

        g.translate(lowx, lowy);
        g.rotate(rad);
        g.drawImage(
            BoardObject.images.get(BoardObject.type2port.get(portContents.get(c))), 0, -75, null);
        g.rotate(-rad);
        g.translate((-1) * lowx, (-1) * lowy);
      }
    }
    g.translate((-1) * _display_offset[0], (-1) * _display_offset[1]);

    synchronized (roadContents) {
      for (Pair c : roadContents.keySet()) {

        Road r =
            new Road(
                hexleft
                    + (((CoordPair) c.getA()).getX() - (((CoordPair) c.getA()).getX() % 2))
                        / 2
                        * intervalSide[0]
                    + (((CoordPair) c.getA()).getX() - (((CoordPair) c.getA()).getX() % 2))
                        / 2
                        * intervalSide[1]
                    + (((CoordPair) c.getA()).getX() % 2) * intervalSide[0],
                hextop + ((CoordPair) c.getA()).getY() * intervalUp);

        r.setX2(
            hexleft
                + (((CoordPair) c.getB()).getX() - (((CoordPair) c.getB()).getX() % 2))
                    / 2
                    * intervalSide[0]
                + (((CoordPair) c.getB()).getX() - (((CoordPair) c.getB()).getX() % 2))
                    / 2
                    * intervalSide[1]
                + (((CoordPair) c.getB()).getX() % 2) * intervalSide[0]);
        r.setY2(hextop + ((CoordPair) c.getB()).getY() * intervalUp);

        r.setColor(roadContents.get(c));
        r.paint(g, _display_offset[0], _display_offset[1]);
      }
    }

    synchronized (vertexContents) {
      for (CoordPair c : vertexContents.keySet()) {
        int newx =
            hexleft
                + ((c._x - (c._x % 2)) / 2 * intervalSide[0]
                    + (c._x - (c._x % 2)) / 2 * intervalSide[1]
                    + (c._x % 2) * intervalSide[0])
                - 20;
        int newy = hextop + c._y * intervalUp - 20;

        if ((BoardObject.type) (vertexContents.get(c).getA()) == BoardObject.type.SETTLEMENT) {
          Settlement s = new Settlement(newx, newy, (Integer) (vertexContents.get(c).getB()));
          s.paint(g, _display_offset[0], _display_offset[1]);
        } else if ((BoardObject.type) (vertexContents.get(c).getA()) == BoardObject.type.CITY) {
          City s = new City(newx, newy, (Integer) (vertexContents.get(c).getB()));
          s.paint(g, _display_offset[0], _display_offset[1]);
        } else System.out.println("neither -_-");
      }
    }

    g.setColor(Color.GRAY);
    g.fill(new Rectangle(0, 0, 110, 60));
    g.setColor(Color.LIGHT_GRAY);
    g.fill(new Rectangle(3, 3, 104, 56));
    if (_dieRoll > 0) {
      BufferedImage r1img =
          diceImage.getSubimage((int) (Math.floor((twoDice[0] - 1) * 94.7)), 0, 94, 93);
      g.drawImage(r1img, 5, 7, 48, 47, null);
      BufferedImage r2img =
          diceImage.getSubimage((int) (Math.floor((twoDice[1] - 1) * 94.7)), 0, 94, 93);
      g.drawImage(r2img, 55, 7, 48, 47, null);
    }

    if (_up != null) _up.paint(g);

    if (!_gameOver.equals("") && !_dismiss) {
      _currAlpha += 0.007;
    }
    g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, _currAlpha));
    g.setColor(Color.GRAY);
    g.fill(new Rectangle(-20, 0, 1020, 650));
    g.setColor(Color.BLACK);
    g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, (float) 1.0));
    if (!_gameOver.equals("")) {

      if (_currAlpha >= 0.8) {
        if (_gameOver.equals(gameLogic._name)) {
          g.drawString("Congratulations, you won!", 350, 200);
        } else {
          g.drawString(_gameOver + " has won!", 350, 200);
        }
        _dismiss = true;
      } else repaint();
    }
  }
예제 #25
0
  /**
   * This calls the other relevant <code>paint...()</code> methods in this object. The layering of
   * the focus varies based on whether it should be painted outside or inside the filled shape, but
   * otherwise the layers are:
   *
   * <ul>
   *   <li>Filling the bounds with <code>button.getBackground()</code> (if <code>button.isOpaque()
   *       </code> is true).
   *   <li>If <code>getShadowHighlight()</code> is non-null, painting the stroke/border 1 pixel
   *       below its usual location.
   *   <li><code>paintBackground(g)</code>
   *   <li><code>paintEffects(g,false)</code>
   *   <li><code>paintIcon(g)</code>
   *   <li><code>paintText(g)</code>
   *   <LI><code>paintForeground(g)</code>
   *   <LI><code>paintEffects(g,true)</code>
   * </ul>
   */
  @Override
  public void paint(Graphics g0, JComponent c) {
    AbstractButton button = (AbstractButton) c;

    if (isLayoutValid(button) == false) updateLayout(button, getButtonInfo(button));

    if (button.isOpaque()) {
      g0.setColor(button.getBackground());
      g0.fillRect(0, 0, button.getWidth(), button.getHeight());
    }

    Graphics2D g = new OptimizedGraphics2D((Graphics2D) g0);

    g.setComposite(getComposite(button));

    ButtonInfo info = getButtonInfo(button);

    Color highlight = fill.getShadowHighlight(button);
    if (highlight != null && isStrokePainted(button)) {
      g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
      g.translate(0, 1);
      g.setColor(highlight);
      g.draw(info.fill);
      g.translate(0, -1);
    }

    PaintFocus focus = getFocusPainting(button);
    boolean hasFocus = hasFocus(button);
    if (Boolean.FALSE.equals(hasFocus) || button.isFocusPainted() == false) focus = PaintFocus.NONE;

    // this shouldn't be an issue, but just in case:
    if (isEnabled(button) == false) focus = PaintFocus.NONE;

    if (focus == PaintFocus.OUTSIDE) {
      if (isFillOpaque()) {
        // the opaque fill will overwrite the inner part of
        // this stroke...
        PlafPaintUtils.paintFocus(g, info.stroke, focusSize);
      } else {
        // this still has some rendering quirks in
        // Quartz (remove the clipping to study closely)
        // ... but other than the top horizontal & vertical
        // line it's OK.  And even those are ... partly there.
        Graphics2D focusG = (Graphics2D) g.create();
        GeneralPath outsideClip = new GeneralPath(Path2D.WIND_EVEN_ODD);
        outsideClip.append(new Rectangle(0, 0, button.getWidth(), button.getHeight()), false);
        outsideClip.append(info.fill, false);
        focusG.clip(outsideClip);
        PlafPaintUtils.paintFocus(focusG, info.stroke, focusSize);
        focusG.dispose();
      }
    }
    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);

    paintBackground(g, info);
    paintEffects(g, info, true);

    g.setStroke(new BasicStroke(1));
    if (focus == PaintFocus.INSIDE) {
      Graphics2D focusG = (Graphics2D) g.create();
      focusG.clip(info.fill);
      PlafPaintUtils.paintFocus(focusG, info.stroke, focusSize);
      focusG.dispose();
      paintStroke(g, info);
    } else if (focus == PaintFocus.BOTH) {
      paintStroke(g, info);
      PlafPaintUtils.paintFocus(g, info.stroke, focusSize);
    } else {
      paintStroke(g, info);
    }

    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    paintIcon(g, info);
    paintText(g, info);

    g.setComposite(isEnabled(button) ? AlphaComposite.SrcOver : SRC_OVER_TRANSLUCENT);
    paintForeground(g, info);
    paintEffects(g, info, false);
  }
예제 #26
0
 public void paintComponent(Graphics g1) {
   animationCount = 1;
   if (!visible) return;
   Graphics2D g = (Graphics2D) g1;
   float width = getWidth();
   float height = getHeight();
   g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
   if (45.0 <= rotate && rotate < 135.0) {
     g.translate(width, 0.0);
     g.rotate(Math.PI * rotate / 180, 0.0, 0.0);
     g.transform(
         AffineTransform.getScaleInstance(height / original_width, width / original_height));
   } else if (135.0 <= rotate && rotate < 225.0) {
     g.rotate(Math.PI * rotate / 180, width / 2, height / 2);
     g.transform(
         AffineTransform.getScaleInstance(width / original_width, height / original_height));
   } else if (225.0 <= rotate && rotate < 315.0) {
     g.translate(-height, 0.0);
     g.rotate(Math.PI * rotate / 180, height, 0.0);
     g.transform(
         AffineTransform.getScaleInstance(height / original_width, width / original_height));
   } else
     g.transform(
         AffineTransform.getScaleInstance(width / original_width, height / original_height));
   if ((dd.dynType & GeDyn.mDynType_Rotate) != 0 && dd.rotate != 0) {
     g.rotate(
         Math.PI * dd.rotate / 180,
         (dd.x0 - getX()) * original_width / width,
         (dd.y0 - getY()) * original_height / height);
   }
   AffineTransform save = g.getTransform();
   AffineTransform save_tmp;
   int rounds = 1;
   if (fillLevel != 1F) rounds = 2;
   int oldColor = 0;
   for (int i = 0; i < rounds; i++) {
     if (rounds == 2) {
       switch (i) {
         case 0:
           if (levelColorTone != GeColor.COLOR_TONE_NO) {
             oldColor = colorTone;
             colorTone = levelColorTone;
           } else if (levelFillColor != GeColor.COLOR_NO) {
             oldColor = fillColor;
             fillColor = levelFillColor;
           }
           break;
         case 1:
           if (levelColorTone != GeColor.COLOR_TONE_NO) colorTone = oldColor;
           else if (levelFillColor != GeColor.COLOR_NO) fillColor = oldColor;
           break;
       }
       switch (levelDirection) {
         case Ge.DIRECTION_UP:
           if (i == 0)
             g.setClip(
                 new Rectangle2D.Float(
                     0F,
                     fillLevel * original_height + Ge.cJBean_Offset,
                     original_width,
                     original_height));
           else
             g.setClip(
                 new Rectangle2D.Float(
                     0F, 0F, original_width, fillLevel * original_height + Ge.cJBean_Offset));
           break;
         case Ge.DIRECTION_DOWN:
           if (i == 0)
             g.setClip(
                 new Rectangle2D.Float(
                     0F,
                     0F,
                     original_width,
                     (1 - fillLevel) * original_height + Ge.cJBean_Offset));
           else
             g.setClip(
                 new Rectangle2D.Float(
                     0F,
                     (1 - fillLevel) * original_height + Ge.cJBean_Offset,
                     original_width,
                     original_height));
           break;
         case Ge.DIRECTION_RIGHT:
           if (i == 0)
             g.setClip(
                 new Rectangle2D.Float(
                     fillLevel * original_width + Ge.cJBean_Offset,
                     0F,
                     original_width,
                     original_height));
           else
             g.setClip(
                 new Rectangle2D.Float(0F, 0F, fillLevel * width + Ge.cJBean_Offset, height));
           break;
         case Ge.DIRECTION_LEFT:
           if (i == 0)
             g.setClip(
                 new Rectangle2D.Float(
                     0F,
                     0F,
                     (1 - fillLevel) * original_width + Ge.cJBean_Offset,
                     original_height));
           else
             g.setClip(
                 new Rectangle2D.Float(
                     (1 - fillLevel) * original_width + Ge.cJBean_Offset,
                     0F,
                     original_width,
                     original_height));
           break;
       }
     }
     {
       int fcolor =
           GeColor.getDrawtype(
               293,
               colorTone,
               colorShift,
               colorIntensity,
               colorBrightness,
               colorInverse,
               fillColor,
               dimmed);
       if (gradient == GeGradient.eGradient_No) {
         g.setColor(GeColor.getColor(fcolor));
         g.fill(shapes[0]);
       } else {
         GeGradient.paint(
             g,
             gradient,
             2,
             -2,
             2F,
             2F,
             13.6808F,
             14.8208F,
             false,
             293,
             colorTone,
             colorShift,
             colorIntensity,
             colorInverse,
             fillColor,
             dimmed);
         g.fill(shapes[0]);
       }
       if (shadow != 0) {
         g.setColor(GeColor.shiftColor(fcolor, -2, colorInverse));
         g.fill(shapes[1]);
         g.setColor(GeColor.shiftColor(fcolor, 2, colorInverse));
         g.fill(shapes[2]);
       }
       g.setStroke(new BasicStroke(1F));
       g.setColor(
           GeColor.getColor(
               0,
               colorTone,
               colorShift,
               colorIntensity,
               colorBrightness,
               colorInverse,
               borderColor,
               dimmed));
       g.draw(shapes[0]);
     }
   }
   if (rounds == 2) g.setClip(null);
   g.setTransform(save);
 }
예제 #27
0
 public void paintComponent(Graphics g1) {
   Graphics2D g = (Graphics2D) g1;
   float width = getWidth();
   float height = getHeight();
   AffineTransform save = g.getTransform();
   AffineTransform save_tmp;
   g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
   if (45.0 <= rotate && rotate < 135.0) {
     g.translate(width, 0.0);
     g.rotate(Math.PI * rotate / 180, 0.0, 0.0);
     g.transform(
         AffineTransform.getScaleInstance(height / original_width, width / original_height));
   } else if (135.0 <= rotate && rotate < 225.0) {
     g.rotate(Math.PI * rotate / 180, width / 2, height / 2);
     g.transform(
         AffineTransform.getScaleInstance(width / original_width, height / original_height));
   } else if (225.0 <= rotate && rotate < 315.0) {
     g.translate(-height, 0.0);
     g.rotate(Math.PI * rotate / 180, height, 0.0);
     g.transform(
         AffineTransform.getScaleInstance(height / original_width, width / original_height));
   } else
     g.transform(
         AffineTransform.getScaleInstance(width / original_width, height / original_height));
   g.setColor(
       GeColor.getColor(
           22,
           colorTone,
           colorShift,
           colorIntensity,
           colorBrightness,
           colorInverse,
           fillColor,
           false));
   g.fill(shapes[0]);
   g.setColor(
       GeColor.getColor(
           20,
           colorTone,
           colorShift,
           colorIntensity,
           colorBrightness,
           colorInverse,
           fillColor,
           false));
   g.fill(shapes[1]);
   g.setColor(
       GeColor.getColor(
           23,
           colorTone,
           colorShift,
           colorIntensity,
           colorBrightness,
           colorInverse,
           fillColor,
           false));
   g.fill(shapes[2]);
   g.setStroke(new BasicStroke(1F));
   g.setColor(
       GeColor.getColor(
           0,
           colorTone,
           colorShift,
           colorIntensity,
           colorBrightness,
           colorInverse,
           borderColor,
           false));
   g.draw(shapes[3]);
   g.setColor(Color.black);
   g.setFont(annot1Font);
   save_tmp = g.getTransform();
   g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
   g.transform(
       AffineTransform.getScaleInstance(original_width / width * height / original_height, 1));
   g.drawString(annot1, 13 * original_height / height * width / original_width, 22F);
   g.setTransform(save_tmp);
   g.setTransform(save);
 }
예제 #28
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;
  }
  @Nullable
  private Point createToolTipImage(@NotNull KeyType key) {
    UIUtil.putClientProperty(myComponent, EXPANDED_RENDERER, true);
    Pair<Component, Rectangle> rendererAndBounds = getCellRendererAndBounds(key);
    UIUtil.putClientProperty(myComponent, EXPANDED_RENDERER, null);
    if (rendererAndBounds == null) return null;

    JComponent renderer = ObjectUtils.tryCast(rendererAndBounds.first, JComponent.class);
    if (renderer == null) return null;
    if (renderer.getClientProperty(DISABLE_EXPANDABLE_HANDLER) != null) return null;

    if (UIUtil.getClientProperty((JComponent) rendererAndBounds.getFirst(), USE_RENDERER_BOUNDS)
        == Boolean.TRUE) {
      rendererAndBounds.getSecond().translate(renderer.getX(), renderer.getY());
      rendererAndBounds.getSecond().setSize(renderer.getSize());
    }

    myKeyItemBounds = rendererAndBounds.second;

    Rectangle cellBounds = myKeyItemBounds;
    Rectangle visibleRect = getVisibleRect(key);

    if (cellBounds.y < visibleRect.y) return null;

    int cellMaxY = cellBounds.y + cellBounds.height;
    int visMaxY = visibleRect.y + visibleRect.height;
    if (cellMaxY > visMaxY) return null;

    int cellMaxX = cellBounds.x + cellBounds.width;
    int visMaxX = visibleRect.x + visibleRect.width;

    Point location = new Point(visMaxX, cellBounds.y);
    SwingUtilities.convertPointToScreen(location, myComponent);

    Rectangle screen =
        !Registry.is("ide.expansion.hints.on.all.screens")
            ? ScreenUtil.getScreenRectangle(location)
            : ScreenUtil.getAllScreensRectangle();

    int borderWidth = isPaintBorder() ? 1 : 0;
    int width = Math.min(screen.width + screen.x - location.x - borderWidth, cellMaxX - visMaxX);
    int height = cellBounds.height;

    if (width <= 0 || height <= 0) return null;

    Dimension size = getImageSize(width, height);
    myImage = UIUtil.createImage(size.width, size.height, BufferedImage.TYPE_INT_RGB);

    Graphics2D g = myImage.createGraphics();
    g.setClip(null);
    doFillBackground(height, width, g);
    g.translate(cellBounds.x - visMaxX, 0);
    doPaintTooltipImage(renderer, cellBounds, g, key);

    CustomLineBorder border = null;
    if (borderWidth > 0) {
      border = new CustomLineBorder(getBorderColor(), borderWidth, 0, borderWidth, borderWidth);
      location.y -= borderWidth;
      size.width += borderWidth;
      size.height += borderWidth + borderWidth;
    }

    g.dispose();
    myRendererPane.remove(renderer);

    myTipComponent.setBorder(border);
    myTipComponent.setPreferredSize(size);
    return location;
  }
예제 #30
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);
   }
 }