Once again, One more tutorial on Method communication. But here we need communication between Applet Life cycle methods and Thread-> run() method. To draw a disc, We have used 4 Arcs of 90 degrees each. For display color rotation, We have used Color[]. Rest everything is self explanatory. You may leave a comment in case you face any difficulty.

File Name: rotateArc.java

import java.applet.*;
import java.awt.*;

public class rotateArc extends Applet implements Runnable
{
	Color[] clr = {Color.red, Color.green, Color.pink, Color.blue};
	int cnt = 0;
	Thread t;
	public void init()
	{
		t = new Thread(this);
		t.start();
		setBackground(Color.black);	
	}
	
	public void run()
	{
		try
		{
			while(true)
			{
				
				repaint();
				t.sleep(1000);
				cnt++;	
				if(cnt>3){cnt=0;}
			}
		}
		catch(Exception e)
		{
			System.out.println(e);	
		}
	}
		
	public void paint(Graphics g)
	{
		int tmp = cnt;
		for(int i=0;i<4;i++)
		{
		 g.setColor(clr[tmp++]);
		 if(tmp>3)tmp=0;
		 g.fillArc(0,0,500,500,90*i,90);
		}
	}	
	
}

/*
<applet code="rotateArc" width="500" height="500"></applet>
*/

p3