import java.applet.Applet;
import java.awt.*;

public class title extends Applet implements Runnable
{
	Thread th=null;
	MediaTracker mt = new MediaTracker(this);
	int j=6,col=0,wid=400,hei=263;
	boolean flag;
	Image imgs1;

	public void init()
	{
		setBackground(new Color(255,255,255));
		imgs1 = getImage(getDocumentBase(),"img/back.gif");
		mt.addImage(imgs1,0);
		flag = true;
	}

	public void update(Graphics g)
	{
		if (flag)
		{
			paint(g);
			flag = false;
		}
		if (col == 0)
			j++;
		if (j > 6)
		{
			j = 0;
		}
		g.setFont(new Font("TimesRoman",Font.BOLD,28));
		if (col > 22)
		{
			switch (j)
			{
			case 0:
				g.setColor(new Color(col,0,0));
				break;
			case 1:
				g.setColor(new Color(0,col,0));
				break;
			case 2:
				g.setColor(new Color(0,0,col));
				break;
			case 3:
				g.setColor(new Color(col,col,0));
				break;
			case 4:
				g.setColor(new Color(col,0,col));
				break;
			case 5:
				g.setColor(new Color(0,col,col));
				break;
			case 6:
				g.setColor(new Color(col,col,col));
				break;
			}
		}
		else
			g.setColor(new Color(col,col,col));
		g.drawString("Graph Draw  -JAVA Version-",15,hei/2);
	}

	public void paint(Graphics g)
	{
		if (imgs1 != null)
		{
			if (mt.checkID(0))
				g.drawImage(imgs1,wid/2-132,0,this);
		}
	}

	public void start()
	{
		if (th == null)
		{
			th = new Thread(this);
			th.start();
		}
	}

	public void run()
	{
		try
		{
			mt.waitForID(0);
		}
		catch(InterruptedException e)
		{
			return;
		}
		
		while (true)
		{
			try
			{
				for (col = 0;col <= 255;col += 16)
				{
					th.sleep(48);
					repaint();
				}
				for (col = 255;col >= 0;col -= 16)
				{
					th.sleep(48);
					repaint();
				}
			}
			catch (InterruptedException e){};
		}
	}

	public void stop()
	{
		if (th != null)
		{
			th.stop();
			th = null;
		}
	}
}
