Java examples for java.awt:Graphics2D
Draw Triangle
//package com.java2s; import java.awt.*; public class Main { public static void DrawTriangle(Graphics g, int x, int y, int w, int h) { //Draw the three lines to make us a nice triangle g.drawLine(x, y, (x - w / 2), (y + h)); g.drawLine(x, y, (x + w / 2), (y + h)); g.drawLine((x - w / 2), y + h, (x + w / 2), y + h); }/*from w w w . j a va2 s . co m*/ }