Java Graphics Draw drawBubbleHead(Graphics2D g, Point2D headPosition, double orientation, double size, Color color, Stroke stroke)

Here you can find the source of drawBubbleHead(Graphics2D g, Point2D headPosition, double orientation, double size, Color color, Stroke stroke)

Description

draw Bubble Head

License

Open Source License

Declaration

public static void drawBubbleHead(Graphics2D g, Point2D headPosition, double orientation, double size,
            Color color, Stroke stroke) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Shape;
import java.awt.Stroke;
import java.awt.geom.AffineTransform;
import java.awt.geom.Ellipse2D;

import java.awt.geom.Point2D;

public class Main {
    public static void drawBubbleHead(Graphics2D g, Point2D headPosition, double orientation, double size,
            Color color, Stroke stroke) {
        double size2 = size / 2;
        double x = headPosition.getX() - size2 * Math.cos(orientation);
        double y = headPosition.getY() - size2 * Math.sin(orientation);

        AffineTransform arrowTransform = new AffineTransform();
        arrowTransform.translate(x, y);//  w  ww . j  a  v a2 s . c  o m
        Shape shape = new Ellipse2D.Double(-size2, -size2, size, size);
        Shape transformedShape = arrowTransform.createTransformedShape(shape);

        g.setColor(Color.WHITE);
        g.fill(transformedShape);
        g.setColor(color);
        g.setStroke(stroke);
        g.draw(transformedShape);
    }
}

Related

  1. drawAutoCompleteMarker(Graphics2D g2, int x, int y, int iconSize)
  2. drawBeamsplit(Graphics g, int midx, int midy, Color cup, Color cdown, Color cright, boolean showMirror, boolean isDichroic)
  3. drawBeamVariableRadiusVertical(Graphics g, Color c, int midx, int y1, int y2, int r1, int r2)
  4. drawBoundary(Graphics2D g2d, Rectangle bounds, Point2D.Double[] pts)
  5. drawBoxOrBlockChar(Graphics g, int x, int y, int bi, char c, int charWidth, int charHeight)
  6. drawBubbles(Graphics g, int nCode)
  7. drawChar(char c, int x, int y, Graphics g)
  8. drawChars(JComponent c, Graphics g, char[] data, int offset, int length, int x, int y)
  9. drawCheck(Graphics g, int x, int y)