CooScale (V1.1)

Downloads, Perperties, Events, Programming issues, and Installation


CooScale is a cool 3D-look multimedia progress bar.

Why: 1). it supports customizable sound and animation with a variety of modes. 2). it provides tooltips. You can show your advertisements, descriptions, and instructions according to progress.(To see this feature, just place your mouse cursor on the bean above to watch it display different content for different percentages). 3). it has better compitability. It can be used with both IE(4.x) and Netscape (4.x). The Adware version is FREE!!

Properties

textColor - percentage text color barForeground - foreground color of progress bar(the part done) barBackground - background color of progress bar(the rest) beanBackground - background color of the bean tipsForeground - foreground color of tooltips tipsBackground - background color of tooltips displayText - a boolean value to determent if display the percentage text percent - value of done bevel - bevel of the 3D bar outerTLShadowColor - TopLeft corner color of bar border outerBRShadowColor - BottomRight corner color of bar border innerTLShadowColor - TopLeft corner color of bar innerBRShadowColor - BottomRight corner color of bar tipsX - tooltips x coordinate tipsY - tooltips y coordinate tipsWidth - tooltips width tipsHeight - tooltips height buttonLabel - label of the button. You can remove the button by seting this field to nothing tipsText - tooltips content. You can turn the tooltips off by placing nothing in this field. soundURL - sound file's complete URL. You can disable sound by placing nothing in this field. firstImageFileURL - first animation image file's complete URL. You can disable animation by placing nothing in this field. numImage - number of animation image files. You can disable animation by seting this field to 0. soundMode - sound mode: 0 play sound when progressing; 1 play sound when mouse enter CooScale soundPlayStyle - 0 play once; 1 loop animationSpeed - animation interval in ms selfTest - a boolean var. CooScale will increase it percentage when mouse enter it if set to true topTips - tooltips will be keep on the top most when set to true autoTipsHeight - CooScale will handle measuring tooltips's height if this is set to true resetAfterCancel - the percentage will be set to 0 when cancel if this field is set to true resetAfterFull - the percentage will be set to 0 when percentage reaches 100% if this field is set to true toCancel - seting this field to true will have to the effect as clicking at the cancel button. This property offer you a way to cancel the progress by other beans. You can also call public method, cancelAll(), from you codes to do the samething.

Registered Action Events and Programming issues:

actionPerFormed - this event is fired when Cancel button is clicked or process is done (100%). To interact with CooScole, you need to connect its listeners to the source, CooScale. You can get the resulting percentage(as a String) from ActionEvent's last field, command, by calling getActionCommand. For example, following System.err.println statement will print the resulting percentage in Java console when the cancel button is clicked or when process is reached 100% void cooscale1_actionPerformed(java.awt.event.ActionEvent event) { System.err.println("Resulting percentage = " + event.getActionCommand()); ... }

There are several sample applets with source codes are available

1). Package One - a simple Netscape compitable applet This is a very simple hand-written applet showing you how to use Cooscale in an applet. caller_cs.java - hand-written applet source file. cooscale.mk - makefile to build jar caller_cs.bat - a batch file which you can use to build jar file in a DOS environment. test_cs.htm - a html file to run the applet 2). Package Two - a timer-driven Cooscale This is an applet built with Visual Cafe (V1.1) showing you how to use Cooscale with other beans in an applet. bean_cs.java - the applet source file. cootimer.java - a timer bean which fires ActionEvent periodically to increase CooScale's percentage. bean_cs.htm - a html file to run the applet 3). Package Three - a timer-driven Cooscale in popup style This is an applet built with Visual Cafe (V1.1) showing you how to popup CooScale. pop_cs.java - the applet source file. Dialog1.java - the dialog source file. cootimer.java - a timer bean which fires ActionEvent periodically to increase CooScale's percentage. bean_cs.htm - a html file to run the applet

Other Public Methods

setApplet(Applet applet) - this method has to be called from CooScale's parent so that it can provide animation and sound. The method should be called right before CooScale is shown or started. closeAll(void) - this method has to be called in parent's stop method so that the parent stop CooScale's sound playing and animation.

Installation Instructions

0). Download CooScale

Note:

You need to use IE 4.x to test any packages above . If you want to use only Netscape 4.x, please download following one
1). Unzip cooscale.zip or bean_cs.zip to, say c:\my_bean and run setup.bat, you will get following files c:\my_bean\cooscale.jar c:\my_bean\cooscale1.gif c:\my_bean\cooscale16.gif c:\my_bean\cooscale2.gif c:\my_bean\cooscale3.gif c:\my_bean\cooscale32.gif c:\my_bean\cooscale4.gif c:\my_bean\cooscale5.gif c:\my_bean\cooscale6.gif c:\my_bean\cooscale7.gif c:\my_bean\cooscale8.gif c:\my_bean\file_id.diz c:\my_bean\setup.bat c:\my_bean\sound25.au c:\my_bean\test.htm c:\my_bean\test.jar c:\my_bean\test.java c:\my_bean\test_cs.htm c:\my_bean\readme.txt Note: be sure that you run setup.bat to rename files. 2). Upload files on to your server, say http://www.mysite.com/ You need to upload following files to your server c:\my_bean\cooscale.jar c:\my_bean\cooscale1.gif c:\my_bean\cooscale16.gif c:\my_bean\cooscale2.gif c:\my_bean\cooscale3.gif c:\my_bean\cooscale32.gif c:\my_bean\cooscale4.gif c:\my_bean\cooscale5.gif c:\my_bean\cooscale6.gif c:\my_bean\cooscale7.gif c:\my_bean\cooscale8.gif c:\my_bean\sound25.au c:\my_bean\test.htm c:\my_bean\test.jar c:\my_bean\test_cs.htm There are two things to try now. If you like to see the running bean following Part I Otherwise, ignore Part I.

Part I: Try the one package with this package

a). Browse test_cs.htm with either IE 4.x or Netscape 4.x. Or b). Browse test.htm with IE 4.x. Test.htm won't work with Netscape since it was built with Visual Cafe but Netscape does not support some classes files used to build Cooscale's caller. Later in this page(see Park II below), you will see step-by-step instructions to build test.jar which is used by test.htm.

Part II: Install it in your applet or application

3). Integrate it in to an applet or application. Let's use Visual Cafe (V1.1) as example. Instructions to insert Cooscale to an applet with Visual Cafe: A). Open Visual Cafe and select File | New Project from the pull-down menu. Then select Basic Applet from New Project dialog. B). Rename your new project and applet name, say test as project name and test as applet name too, and then save it at c:\my_test. Save the project. C). Selete Insert | Component into Library... from menu. Then select cooscale.jar that you unzipped at step 1). That is, c:\my_bean\cooscale.jar D). Selete Insert | Component from menu. Then select cooscale from component list and add it to the project. Change following properties FirstImageFileURL - change it to http://www.mysite.com/cooscale1.gif SoundURL - change it to http://www.mysite.com/sound25.au You have to change these properties in order to have sound and animation since an applet can not fetch any resource from any places other than where it comes from. You need to set property "selfTest" to true in the property list so that you can simulate a progress by placing mouse cursor on the bean. E). Right mouse click at test in the project dialog and select Edit Source (or click at test in the dialog and select Object | Edit Source from menu). Then add following statement to init() cooscale1.setApplet(this); right after //{{INIT_CONTROLS .... //}} You will get something like ... //{{INIT_CONTROLS setLayout(null); setSize(289,127); try { ClassLoader cl = Class.forName("cooscale").getClassLoader(); cooscale1 = (cooscale) java.beans.Beans.instantiate(cl, "cooscale"); cooscale1.setLayout(new FlowLayout(FlowLayout.CENTER,5,5)); cooscale1.setBounds(36,36,216,36); add(cooscale1); cooscale1.start(); } catch (Exception e) { } //}} cooscale1.setApplet(this); //<<<<<<<< ADD IT HERE !!!!! ... in init(). Note: you better place cooscale1.setApplet(this) outside of //{{INIT_CONTROLS .... //}} Otherwise, your addition will be overwritten whenever a change is made in IDE. E). Add following method to the applet public void stop() { cooscale1.cancelAll(); } This will tell the bean to stop sound and animation when the parent applet stops. F). Compile the project and try it locally. If it work, select Project | JAR... from menu and click at More>>> button. Then, click at test.class and check Bean radio button at the bottom of the dialog. Click at OK to generate test.jar. Note: in Visual Cafe V1.1, please don't check any other class as Bean - test.class is the only one you need to mark as a bean. G). Try it online. Create a html document file, say test.htm, containing content like <APPLET Archive="test.jar" CODE="test.class" WIDTH=240 HEIGHT=50></APPLET> Upload test.jar and test.htm to http://www.mysite.com and browse http://www.mysite.com/test.htm with IE 4.x. If you like to try something which can be used in both IE and Netscape, you need to build a simple applet that call CooScale since applets generated by Visual Cafe (V1.1) contain some classes which are not supported by Netscape (V4.x). You can download another package
Following the instructions in its readme.txt to build your jar file. With this package, you will be able to build your own test_cs.jar packed in this package.