How to Draw Arc in Java


Here we may learn how to draw arc in an applet window using drawArc method of Graphics class.

Source Code

package com.beginner.examples;

import java.applet.Applet;
import java.awt.Color;
import java.awt.Graphics;
 
public class DrawExample2 extends Applet{
 
	public void paint(Graphics g){
		
		g.setColor(Color.green);
		// draw arc
		g.drawArc(10, 20, 50, 130, 10, 90);
		System.out.println("ok");
	}
}

Output:

ok

References

Imported packages in Java documentation:

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments