In this section, you will learn how to draw an arc in Graphics.
An arc of a circle is a segment of the circumference of the circle. To draw an arc, class Arc2D is used. To give the stylistic and impressive way to the outline of arc, we have used BasicStroke class. The float value passed into the constructor of Class BasicStroke shows the thickness of the outline.
The method setPaint() paints the shape with specified color. The method setStroke() sets the stroke settings. The method frame.setSize() sets the size of frame and frame.show() shows the frame.
Here is the code of DrawAnArc.java
Download Source Code
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