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
Liked it! Share this Tutorial