CooTips (1.00)
CooTips is a JavaBean that allows you to attach
tooltips to components such as buttons, listboxes,
and choices in applets and applications.
It also allows you to attach sounds to components.
Note: Cootips requires a JDK1.1 environment since
Cootips is usually used with components'
mouseEnter event which is supported in
a JDK1.1 environement(JDK1.0 only supports
mouseEnter for containers).
IE (4.x) is the best browser to view Cootips.
Netscape 4.x doesn't provide a complete JDK1.1 environment
unless you use an upgraded Netscape.
Important:
If you test Cootips locally, please DON'T simply double click
at test_ct.htm. Instead, you should open a browser first then
drag the icon of test_ct.htm from Windows Explorer and drop it
into the browser.
TheAdware version is FREE.
A major difference between an Adware version and a registered
shareware version is that Adware version randomly
replaces your tips with author's ad.
Properties:
tipsWindowWidth - width of the tips window
tipsFont - font of the tips
text - context of tooltips. This property is
shared by all components using CooTips.
You don't need to set it separately. It will
be set by setTips method. setTips is the only
method you need to call to control Cootips.
Only 100 charaters are allowed in an Adware version.
audioFile - complete URL of audio file. Similar to property "text",
this property will be set by setTips.
tipsForeground - foreground color of tips
tipsBackground - background color of tips
maxStoredSound - size of sound cache. To save loading time(avoid reload
audio files loaded proviously, Cootips
caches audio files it loads. You better set this size
to the total number of audio files used by Cootips
since old ones will be overwriten when the cache is not
big enough.
defaultX - default X position of tips window. If you use Cootips in
an applet you may want specify a default value for it and
set property useDefaultPosition to true since Cootips has
difficulty to detect mouse cursor in applets.
defaultY - default Y position of tips window.
useDefaultPosition - if ture, Cootips uses the postion specified by defaultX and
defaultY. It is usually used for an applet.
soundLoop - if true, Cootips play sound repeatly
The key to attach Cootips to your components:
You only need one instance of Cootips to provide tooltips and sound to
all your components.
You need to call one and only one method, setTips,
from MouseEntered event handler of each component
which you like to attach a tooltips or a sound to
in an applet or application.
For example, for button1, you need to do following to attach a tooltips
and a sound to it:
void button1_MouseEntered(java.awt.event.MouseEvent event)
{
cootips.setTips(event, "put your tips content here", "http://www.yoursite.com/your_audio.au", false);
}
where
the first parameter - the event passed by the MouseEntered event handler
This event handler is used to target the position of
the component in an application. It is ignore in an
applet. Cootips will ignore it if it is set to null.
the second one - content of tips. Set it to "" if you like to hide the tips window.
You usually call setTips with "" as the second parameter in MouseEntered
of the container(parent of components) such a panel, an applet, or a window
so that as soon as mouse cursor exit components - that is, as soon as it
enter components' parents, tips window is hidden.
the third one - the complete URL of the audio file. You can set it to "" if you don't want
sound for this component.
the forth one - play sound repeatly if true. the default is false.
There are may overload versions of setTips(that is, you can set tips in any of following formats):
public void setTips()
public void setTips(String text)
public void setTips(String text, String audioFile)
public void setTips(String text, String audioFile, boolean soundLoop)
public void setTips(java.util.EventObject tipsEvent, String text)
public void setTips(java.util.EventObject tipsEvent, String text, String audioFile)
public void setTips(java.util.EventObject tipsEvent, String text, String audioFile, boolean soundLoop)
where all the ignore arguments are set to "" or false. For example, setTips(String text) sets
audioFile="" and soundLoop=false.
It is recommended that you use the first group(without argument "event")
for applets and the second group(with argument "event") for applications.
For example, if you dont't want sound in an applet, you may call
void button1_MouseEntered(java.awt.event.MouseEvent event)
{
cootips.setTips("put your tips content here");
}
If you only like to have sound without looping but no tips, you may call
void button1_MouseEntered(java.awt.event.MouseEvent event)
{
cootips.setTips("", "http://www.yoursite.com/your_audio.au");
}
Sample Codes
Here is the source codes of the applet, test_ct.java, which uses CooTips
in the demo page.
Installation Instructions:
0). Download Cootips at
html/bean_ct.htm
1). Unzip cootips.zip to, say c:\my_bean
you will get following files
c:\my_bean\file_id.diz
c:\my_bean\Readme.txt
c:\my_bean\cootips.jar
c:\my_bean\test_ct.class
c:\my_bean\test_ct$SymMouse.class
c:\my_bean\test_ct.htm
c:\my_bean\sound23.au
c:\my_bean\sound22.au
2). Upload files on to your server, say http://www.mysite.com/
You need to upload following files to your server and you
will get them as following
http://www.mysite.com/cootips.jar
http://www.mysite.com/test_ct.class
http://www.mysite.com/test_ct$SymMouse.class
http://www.mysite.com/test_ct.htm
http://www.mysite.com/sound23.au
http://www.mysite.com/sound22.au
3). Try it online. Browse http://www.mysite.com/test_ct.htm with IE 4.x
or upgrated Netscape. Note: a regular Netscape browser downloaded
from Netscape won't work. You need to upgrate it to support JDK1.1.
Go
http://www.javaworld.com/javaworld/javatips/jw-javatip51.html?040698txt
to upgrate it.
Or simply switch to IE (4.x)