I am trying to create two triangles with one being upside down and on top of the other. However, the program is only painting the first triangle. What am I doing wrong?
public class Triangle extends Applet {
public void paint( Graphics g ) {
int[] xPoints = {10, 260, 135};
int[] yPoints = {250, 250, 10};
int numPoints = 3;
// Set the drawing color to black
g.setColor(Color.black);
// Draw a filled in triangle
g.fillPolygon(xPoints, yPoints, numPoints );
}
public void newTriangle( Graphics h ) {
int[] xPoints2 = {135, 395/2, 145/2};
int[] yPoints2 = {250, 130, 130};
int n = 3;
h.setColor(Color.white);
h.fillPolygon(xPoints2, yPoints2, n);
}
}