Here you can find the source of drawBubbleHead(Graphics2D g, Point2D headPosition, double orientation, double size, Color color, Stroke stroke)
public static void drawBubbleHead(Graphics2D g, Point2D headPosition, double orientation, double size, Color color, Stroke stroke)
//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); } }