/*
	A basic extension of the java.applet.Applet class
 */

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

import cootimer;
import cooscale;
public class bean_cs extends Applet
{
    int percent = 0;
	public void init()
	{
		// Take out this line if you don't use symantec.itools.net.RelativeURL or symantec.itools.awt.util.StatusScroller
		symantec.itools.lang.Context.setApplet(this);
	
		// This code is automatically generated by Visual Cafe when you add
		// components to the visual environment. It instantiates and initializes
		// the components. To modify the code, only use code syntax that matches
		// what Visual Cafe can generate, or Visual Cafe may be unable to back
		// parse your Java file into its visual environment.
		//{{INIT_CONTROLS
		setLayout(null);
		setSize(241,116);
		setBackground(new Color(65535));
		cootimer1 = new cootimer();
		//$$ cootimer1.move(0,0);
		button1 = new java.awt.Button();
		button1.setLabel("Start");
		button1.setBounds(60,84,108,26);
		button1.setBackground(new Color(12632256));
		add(button1);
		try {
		ClassLoader cl = Class.forName("cooscale").getClassLoader();
		cooscale1 = (cooscale) java.beans.Beans.instantiate(cl, "cooscale");
		cooscale1.setLayout(null);
		cooscale1.setBounds(12,12,216,60);
		cooscale1.setBackground(new Color(12632256));
		add(cooscale1);
		cooscale1.start();
		} catch (Exception e) { }
		//}}
		
		cooscale1.setApplet(this);
	
		//{{REGISTER_LISTENERS
		SymAction lSymAction = new SymAction();
		cootimer1.addActionListener(lSymAction);
		cooscale1.addActionListener(lSymAction);
		button1.addActionListener(lSymAction);
		//}}
	}
	
	//{{DECLARE_CONTROLS
	cootimer cootimer1;
	java.awt.Button button1;
	cooscale cooscale1;
	//}}

	class SymAction implements java.awt.event.ActionListener
	{
		public void actionPerformed(java.awt.event.ActionEvent event)
		{
			Object object = event.getSource();
			if (object == cootimer1)
				cootimer1_actionPerformed(event);
			else if (object == cooscale1)
				cooscale1_actionPerformed(event);
			else if (object == button1)
				button1_Action(event);
		}
	}

	void cootimer1_actionPerformed(java.awt.event.ActionEvent event)
	{
		// to do: code goes here.
		percent ++;	
		if (percent==10)
		{
		  
		  cooscale1.setTipsText("You can display descriptions, advertisements, or instructions according to different percentages");
		  cooscale1.showTips();
		}
	    else if (percent==20)
		{
		  
		  cooscale1.setTipsText("A key thing to do when you insert this bean to your applet is that to call setAppelt after you show or start Cooscale. Go http://www.coolshare.com/html/src/caller_cs.java to see the sample codes.");
		  cooscale1.showTips();
		}
		else if (percent==30)
		{
		  
		  cooscale1.setTipsText("Current version of Cooscale can be only used in applets. If you use it in an application, you will lose its sound and animation icon.");
		  cooscale1.showTips();
		}
		else if (percent==40)
		{
		  
		  cooscale1.setTipsText("Cooscale will automatically remove the space for animation icon if it could not load images. It will also replace the original url text of the first image file with 'can't load image file'.  This occurs if you use it in an appliction or view it in BeanBox.");
		  cooscale1.showTips();
		}
		else if (percent==50)
		{
		  
		  cooscale1.setTipsText("Cooscale will replace the original url text of the first image file with 'can't load audio file'. This occurs if you use it in an appliction or view it in BeanBox.");
		  cooscale1.showTips();
		}
		else if (percent==60)
		{
		  
		  cooscale1.setTipsText("Cooscale comes with two versions: registered shareware version and Adware version. Adware version is FREE but its tooltips will display author's information and it will switch current page to author's home page if you click at it.");
		  cooscale1.showTips();
		}
		else if (percent==70)
		{
		  
		  cooscale1.setTipsText("There are a lot of Java stuff in Mark Qian's www.coolshare.com: FREE Java applets, Java beans, screen savers....");
		  cooscale1.showTips();
		}
		else if (percent==80)
		{
		  
		  cooscale1.setTipsText("Details for installation and donwloading latest version of Cooscale are available at http://www.coolshare.com/html/bean_cs.htm");
		  cooscale1.showTips();
		}
		else if (percent==90)
		{
		  
		  cooscale1.setTipsText("The Cooscale on this page is driven by a timer bean to simulate a real process. Cooscale works on both IE(4.x) and Netscape(4.x). To view Cooscale demo with IE(4.x) please go http://www.coolshare.com/html/bean_cs.htm . To view Cooscale with Netscape(4.x) go http://www.coolshare.com/html/test_cs.htm .");
		  cooscale1.showTips();
		}
		//{{CONNECTION
		// setPercent...
		{
			cooscale1.setPercent(percent);
		}
		//}}
	}

	void cooscale1_actionPerformed(java.awt.event.ActionEvent event)
	{
	System.err.println("Enter cooscale1_actionPerformed Command=" + event.getActionCommand());    
		// to do: code goes here.
		percent = 0;	 
		//{{CONNECTION
		// setRunTimer...
		{
			cootimer1.setRunTimer(false);
		}
		//}}
	}

	void button1_Action(java.awt.event.ActionEvent event)
	{
		// to do: code goes here.
			 
		//{{CONNECTION
		// setRunTimer...
		{
			cootimer1.setRunTimer(true);
		}
		//}}
	}
}
