You need to specify the vertices of your polygon (in this case, a triangle) and go to fillPolygon():
public void paint(Graphics g)
{
int xpoints[] = {25, 145, 25, 145, 25};
int ypoints[] = {25, 25, 145, 145, 25};
int npoints = 5;
g.fillPolygon(xpoints, ypoints, npoints);
}
source
share