import javax.swing.*;
import java.awt.geom.*;
import java.awt.image.*;
import java.net.URL;
import java.awt.*;

public class textureElipsSWF_2000 extends JFrame {

    TexturePaint tp = getImageTexture("sybex.gif");
    final static Color kirmizi=Color.red;
    final static Color beyaz=Color.white;
    final static Color siyah=Color.black;

    public textureElipsSWF_2000()
    {
        super("Elips çizimi");
        setBackground(beyaz);
        setForeground(siyah);
    }

    public TexturePaint getImageTexture(String imageFile)
    {
    URL url = getClass().getResource("sybex.gif");
    Image img = getToolkit().getImage(url);
    try {
      MediaTracker tracker = new MediaTracker(this);
      tracker.addImage(img, 0);
      tracker.waitForID(0);
    } catch (Exception e) {
    }
    int width = img.getWidth(this);
    int height = img.getHeight(this);
    BufferedImage buffImg = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
    Graphics g = buffImg.getGraphics();
    g.drawImage(img, 0, 0, this);
    Rectangle2D rect = new Rectangle(0, 0, width, height);
    return new TexturePaint(buffImg, rect);
  }
  //************
    public void paint(Graphics g) {
        Graphics2D g2 = (Graphics2D)g;
        g2.setPaint(tp);
        Ellipse2D elips1=new Ellipse2D.Double(55,55,90,30);
        g2.fill(elips1);
        g2.setPaint(siyah);
        Ellipse2D elips2=new Ellipse2D.Double(50,50,100,40);
        g2.draw(elips2);
        g2.setStroke(new BasicStroke(2f,BasicStroke.CAP_ROUND,
        BasicStroke.JOIN_ROUND,3f,new float[] {10f},0f));
        g2.setPaint(Color.black);
        Ellipse2D elips3=new Ellipse2D.Double(50,150,100,40);
        g2.draw(elips3);
        GradientPaint kirmizidanbeyaza=new GradientPaint(250,50,kirmizi,350,90,beyaz);
        g2.setPaint(kirmizidanbeyaza);
        Ellipse2D elips4=new Ellipse2D.Double(250,50,100,40);
        g2.fill(elips4);
        g2.setPaint(tp);
        Ellipse2D elips5=new Ellipse2D.Double(250,150,100,40);
        g2.fill(elips5);
        g2.setStroke(new BasicStroke(2f,BasicStroke.CAP_ROUND,
        BasicStroke.JOIN_ROUND,1f,new float[] {5f},0f));
        g2.setPaint(Color.black);
        g2.draw(elips5);
    }

    //=====================================================
      public static void main(String[] args)
      {
      textureElipsSWF_2000 pencere= new textureElipsSWF_2000();
      pencere.addWindowListener(new BasicWindowMonitor());
      pencere.setSize(300,300);
      pencere.setVisible(true);
      }
  //************

}