0

I need to know how to create a triangle, and how to fill it with color. I am new to programming and would appreciate the help. I am not running the applet in a web browser, just executing it. Thanks.

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by jasimp
0

This should get you started. I hope you will realize you need a little more than that but you can probably figure it out.

int [] xcoords = { 1,2,3,1}   // example
int [] ycoords = {1,2,3,1 }   

Polygon triangle = new Polygon(xcoords,ycoords,number of points);
g.setColor(Color);
g.fillPolygon(triangle);
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.