To avoid nasty looking "jaggies", you might want to look into Graphics2D.setRenderingHint(...) to handle antialiasing. Here are a couple of utility methods I wrote for getting the current antialiasing state (in case you want to save and restore it) and for setting the state on and off:
Joined: Oct 19, 2007
I didnt get your code. I want the code for drawing triangle
On your way in you may have missed that we have a policy on screen names here at JavaRanch. Basically, it must consist of a first name, a space, and a last name, and not be obviously fictitious. Since yours does not conform with it, please take a moment to change it, which you can do right here.
As to your question, a triangle is a polygon with 3 line segments. So after defining the polygon, a call to drawPolygon will draw it.
Alternatively, you can draw it using 3 drawLine calls.