import java.io.*;
import java.applet.*;
import java.util.*;
import javax.swing.*;
import java.awt.*;
import java.awt.geom.*;
import java.awt.event.*;

public class graph4 extends JApplet  
{ 
    final static Color kirmizi=Color.red;
    final static Color beyaz=Color.white;
    final static Color siyah=Color.black;

  public void init()
  {      
  }

    public void paint(Graphics g) 
    {   Graphics2D g2 = (Graphics2D)g;
        g2.setPaint(Color.blue);
        Rectangle2D dikdortgen1=new Rectangle2D.Double(55,55,90,30);
        g2.fill(dikdortgen1);
        g2.setPaint(siyah);
        Rectangle2D dikdortgen2=new Rectangle2D.Double(50,50,100,40);
        g2.draw(dikdortgen2);
        g2.setStroke(new BasicStroke(2f,BasicStroke.CAP_ROUND,
        BasicStroke.JOIN_ROUND,3f,new float[] {10f},0f));
        g2.setPaint(Color.black);
        Rectangle2D dikdortgen3=new Rectangle2D.Double(50,150,100,40);
        g2.draw(dikdortgen3);
        GradientPaint kirmizidanbeyaza=new GradientPaint(250,50,kirmizi,350,90,beyaz);
        g2.setPaint(kirmizidanbeyaza);
        Rectangle2D dikdortgen4=new Rectangle2D.Double(250,50,100,40);
        g2.fill(dikdortgen4);
        GradientPaint kirmizidanmaviye=new GradientPaint(250,150,kirmizi,350,190,Color.blue);
        g2.setPaint(kirmizidanmaviye);
        Rectangle2D dikdortgen5=new Rectangle2D.Double(250,150,100,40);
        g2.fill(dikdortgen5);
        g2.setStroke(new BasicStroke(2f,BasicStroke.CAP_ROUND,
        BasicStroke.JOIN_ROUND,1f,new float[] {5f},0f));
        g2.setPaint(Color.black);
        g2.draw(dikdortgen5);


    }

    public static void main(String s[])
    {
        JFrame f = new JFrame("Grafik ekran genel programę");
        f.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {System.exit(0);}
        });
        JApplet applet = new graph4();
        f.getContentPane().add("Center", applet);
        applet.init();
        f.pack();
        f.setSize(new Dimension(800,400));
        f.show();
    }
}





