

 import javax.swing.*;

 import java.awt.event.*;

 import java.awt.*;



 public class Fan extends JFrame{

Timer t;
JButton b ;


 public Fan() {
 	
 	
setLayout(new BorderLayout());
 
 Arc a=new Arc();
 add(a,BorderLayout.CENTER);


 t=new Timer(1000, new startListener());
t.start();


b= new JButton("start");
add(b,BorderLayout.SOUTH);


ActionListener l= new startListener();
b.addActionListener(l);



}

 

 class Arc extends JPanel {
        @Override
 protected void paintComponent(Graphics g) {
 super.paintComponent(g);
 g.setColor(Color.BLACK);
     for(int i=0;i<=270;i=i+90){
        g.fillArc(50,45,180,180, i, 50);
            }
 }
 }
 

class startListener implements ActionListener {

    public void actionPerformed(ActionEvent e) {
 repaint();
 
 }
 }




public static void main(String[] args) {
  	 Fan frame = new Fan();

 frame.setTitle("FAN");
 frame.setLocation(400,300);
 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 frame.setSize(300,350);
 frame.setVisible(true);

  }

 }