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

public class yildizciz2Dbean extends JPanel implements ActionListener,Serializable
{
   
    final static Color bg=Color.white;
    final static Color fg=Color.black;
    final static Color kirmizi=Color.red;
    final static Color beyaz=Color.white; 

    public yildizciz2Dbean()
    {
    setSize(getPrefferedSize());
    }

    public void init() 
    {
        setBackground(bg);
        setForeground(fg);
    }


    public Dimension getMinimumSize()
    {
      return getPrefferedSize();
    }

    public Dimension getPrefferedSize()
    {
      return new Dimension(180,100);
    }

    public void paintComponent(Graphics g2) 
    {
            
        super.paintComponent(g2);
        Graphics2D g = (Graphics2D) g2;  
        Dimension boyut=getSize();
        int dx=boyut.width/2;
        int dy=boyut.height;
        g.setColor(getBackground());
        g.draw3DRect(0,0,boyut.width-1,boyut.height-1,true);
        g.draw3DRect(3,3,boyut.width-7,boyut.height-7,false);
        //cizgiciz
        yildizSW.drawYildiz(g,dx/2,dy/2, 3,dy/2-5,0 );
        g.setPaint(renk.kirmizi);
        yildizSW.fillYildiz(g,dx/2,dy/2, 3,dy/2-5,0 );
        g.setPaint(renk.mavi);
        yildizSW.drawYildiz1(g,3*dx/2,dy/2, 3,dy/2-5,0 );
    }

    public void actionPerformed(ActionEvent e)
    {
    repaint();
    }

    public static void main(String s[]) {

        yildizciz2Dbean yildiz=new yildizciz2Dbean();
        JFrame f = new JFrame("yildiz ciz 2D ");
        f.getContentPane().add(yildiz,BorderLayout.CENTER);
        f.addWindowListener(
          new WindowAdapter()
          {
            public void windowClosing(WindowEvent e)
            {
              System.exit(0);
            }
          }
        );
        f.setSize(yildiz.getPrefferedSize().width+10,
                  yildiz.getPrefferedSize().height+30);
        f.show();
    }
}
