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
We have 1000s of tutorials on our website. Search Tutorials tutorials on our website.
Posted on: October 16, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles