Graphics2D: Dessiner un Arc 2D Circulaire

Author:

 set, java, swing, awt, JFrame
{filelink=9433}


 import java.awt.*;
 import java.awt.geom.*;
 import  javax.swing.*;

 class ArcCirculaire extends JFrame {

	public ArcCirculaire()
	{
	setTitle("Java 2D");
    setSize(200, 200);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setVisible(true);
	}

   public void paint(Graphics g)
   	{
   		// Dessiner l'arc en mode Circulaire
   Graphics2D g2 = (Graphics2D)g;
   Arc2D arc_pi = new Arc2D.Float(0, 50, 150, 150, -30, 90, Arc2D.PIE);
   g2.setPaint(Color.blue);
   g2.fill(arc_pi);
   }	

 public static void main(String[] args)
  {
   new ArcCirculaire();
  }

}

Leave a Reply

Your email address will not be published. Required fields are marked *