5

Java-Arcs

Arcs

An arc is a part of an oval. In fact, we can think of an oval as a series of arcs that are connected together in an orderly manner. The drawArc( ) designed to draw arcs takes six arguments. The first four are the same as the arguments for drawOval( ) method and the last two represent the starting angle of the arc and the number of degrees around the arc. The fillArc( ) method draws a solid arc.

Program

0 (1)

Program Source

import java.applet.Applet;
import java.awt.Graphics;
import java.awt.Color;

public class Javaapp extends Applet {
   
    public void paint(Graphics g) {
       
        g.setColor(Color.PINK);
        g.fillArc(20, 20, 100, 100, 180, 180);
        g.drawArc(140, 20, 100, 100, 360, 180);
        g.fillArc(20, 140, 100, 100, 360, 270);
        g.drawArc(140, 140, 100, 100, 180, 270);
    }
}

Leave a Comment