Inactive Tutor answered 05/21/19
Tutor
New to Wyzant
If you make a polygon from the vertices, you can use the fillPolygon() function to set the color of the triangle.
To make the triangle, make two arrays to hold the coordinates for each vertex of the triangle.
Ex:
xPts[0] = 1; xPts[1] = 2; xPts[2] = 3;
yPts[0] = 1; yPts[1] = 2; yPts[2] = 1;
Then make a polygon using these coordinates and use fillPolygon().
n = 3; //# of sides in the polygon
Polygon p = new Polygon(xPts, yPts, n);
g.fillPolygon(p);