// set the initial coordinate of the General Path triangle.moveTo( x[ 0 ], y[ 0 ] );
// create the triangle--this does not draw the triangle for ( int count = 1; count < x.length; count++ ) triangle.lineTo( x[ count ], y[ count ] );
triangle.closePath(); // close the shape
// set random drawing color g2d.setColor( new Color( ( int ) ( Math.random() * 256 ), ( int ) ( Math.random() * 256 ), ( int ) ( Math.random() * 256 ) ) );
g2d.translate( 25, 25 ); // set start area
g2d.fill( triangle ); // draw filled triangle
}
} // end method paint
public static void main( String args[] ) { Hwk1 application = new Hwk1(); application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); }