List of utility methods to do Draw Triangle
Shape | drawTriangle(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); ... |
void | drawTriangle(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); |