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

public class Elipsciz2D extends JApplet {
   
    
public void init() 
{
    setBackground(bg);
    setForeground(fg);
}


    public void paint(Graphics g) 
    {
        Graphics2D g2 = (Graphics2D) g;       
        Dimension boyut=getSize();
        int dx=boyut.width/2;
        int dy=boyut.height;
        //çerceve ciz
        g2.setPaint(Color.lightGray);
        g2.draw3DRect(0,0,boyut.width-1,boyut.height-1,true);
        g2.draw3DRect(3,3,boyut.width-7,boyut.height-7,false);
        //cizgiciz
        g2.setPaint(new Color(0,255,255));
        g2.draw(new Ellipse2D.Double(10,10,200,100));
        g2.setPaint(new Color(255,0,0)); 
        g2.setPaint(fg);
        g2.drawString("Elips",10,dy-5);
        GradientPaint kirmizidanbeyaza=new GradientPaint(10+dx,10,kirmizi,(10+dx+210),10,beyaz);
        g2.setPaint(kirmizidanbeyaza);
        g2.fill(new Ellipse2D.Double(10+dx,10,200,100));        
        g2.setPaint(fg);                
        g2.draw(new Ellipse2D.Double(10+dx,10,200,100));        
        g2.drawString("boyalı Elips",10+dx,dy-5);
    }

    public static void main(String s[]) {
        JFrame f = new JFrame("Elips ciz 2D ");
        f.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {System.exit(0);}
        });
        JApplet applet = new Elipsciz2D();
        f.getContentPane().add("Center", applet);
        applet.init();
        f.pack();
        f.setSize(new Dimension(550,200));
        f.show();
    }

}
