This section illustrates you how to draw a triangle using a Line2D.
To draw a triangle, we are using Line2D class of package java.awt.geom.*. This class provides a line segment in (x, y) coordinate space. We have draw three line segments using the class Line2D to create a triangle.
The setPaint() method paints the line segment.
Here is the code of DrawTriangleUsingLine.java
Output will be displayed as:
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: October 16, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles