Java Utililty Methods Draw Triangle

List of utility methods to do Draw Triangle

Description

The list of methods to do Draw Triangle are organized into topic(s).

Method

ShapedrawTriangle(Graphics2D graphics, double x, double y, double height, double width)
draw Triangle
final GeneralPath triangle = new GeneralPath();
triangle.setWindingRule(Path2D.WIND_EVEN_ODD);
triangle.moveTo(x - (width / 2.0), y - (height / 2));
triangle.lineTo(x + (width / 2.0), y - (height / 2));
triangle.lineTo(x + (width / 2.0), y + (height / 2));
triangle.lineTo(x - (width / 2.0), y - (height / 2));
triangle.closePath();
graphics.draw(triangle);
...
voiddrawTriangle(int x, int y, int size, Graphics2D graphics2D)
draw Triangle
int xa[] = { x, x + size / 2, x - size / 2 };
int ya[] = { y - size / 2, y + size / 2, y + size / 2 };
graphics2D.drawPolygon(xa, ya, 3);