TextButton
Version 2.0
Copyright © Rob Young 1997.

•	The Legal Stuff
Permission to use, copy, and distribute this software and its documentation without fee for NON-COMMERCIAL purposes is hereby granted, according to the details contained in the enclosed License.rtf.   Please read that document before continuing.

COMMERCIAL USERS ARE REQUIRED TO REGISTER this software before using it in connection with any commercial enterprise, including its publication on any World Wide Web site intended to publicize, form a part of, or otherwise assist a commercial venture.

Non-commercial users are (of course!) encouraged to register, but are under no obligation to do so.  All registered users will be entitled to 6 month's free email support, free updates of the registered title if and when available, and notification of new titles.

For details of pricing and registration, read the accompanying document Register.rtf.

USE OF THIS SOFTWARE IS TAKEN TO INDICATE ACCEPTANCE OF THE ABOVE TERMS, AND THOSE LAID OUT IN THE ACCOMPANYING LICENSE DOCUMENT.

•	Overview
TextButton is a simple mouse-reactive button.  When the mouse moves over the button, the button's Label changes color and the targetted URL (or other message) is displayed in the status-bar.  Clicking the button fetches the linked page and displays it in a user-defined frame or window.  If you change your mind after clicking the button, drag the pointer out of the applet to cancel the action.

•	Applet Tag
Add the following code to your HTML page:

<APPLET CODE="ryTextButton.class" CODEBASE="classes" WIDTH=120 HEIGHT=22>
<param name=FontName value="Helvetica">
<param name=FontSize value="12">
<param name=FontStyle value="1">
<param name=ButtonColor value="C000C0">
<param name=Label value="Click Me">
<param name=LabelColor value="000000">
<param name=LabelFocusColor value="FFFFFF">
<param name=LabelPressedColor value="C000C0">
<param name=3D value="off">
<param name=Sound value="yes">
<param name=URL value="http://www.btinternet.com/~ry/WebSight/">
<param name=Target value="_top">
<param name=StatusMessage value="Dozens of Java™ & JavaScript applets for download!"/>
</APPLET>

•	Parameters & Values
If you're familiar with the <applet> tag, some of this will be painfully obvious.  Just skip it and cut to the chase.

Note that the only required <param> tags are Label and URL.  All others have default settings which, if you want to use them, may be left out of your HTML document.  

codebase
The location in which the class file (ryTextButton.class) can be found relative to the directory containing the HTML document in which you've used the applet.  By default, the applet will search in the HTML document's directory if this attribute is missing.

code
This should always read "ryTextButton.class", and case is vital.

width
The width of the applet.  Increasing or reducing this will make the button & menu wider or narrower, thus allowing for longer Label strings.  

height
The height of the applet.  Increasing or reducing this will make the button taller or shorter.  

Note:  the label-text will remain centered on the button whatever the applet dimensions.

FontName
The font-face to use for the button-label.  The default is TimesRoman.

FontSize
The size of font to use for the button-label.  The default is 12.

FontStyle
The style of the font for the button-label:	"0"  means Plain (the default)
					"1" means Bold 
					"2" means Italic
					"3" means Bold & Italic

ButtonColor
Hex triplet for the color of the button.  This is a 3D button, so stick with 'mid-range' colors such as C0C000 or 008080 to ensure that the applet can derive lighter and darker shades for the button-highlight and button-shadow.  The default is 008000 (mid-green).

Label
The text you want to appear on the button.  The default is no text.  This text will be automatically centered on the button, but longer strings might require that you increase the applet's width.

LabelColor
A hex-triplet for the color of the button-label text when unfocussed (the mouse isn't over it). The default is 000000 (black).

LabelFocusColor
The color of the button-label text when focussed (the mouse is over it).  The default is FFFFFF (white).

LabelPressedColor
The color of the button-label text when the button is depressed.  The default is 000000 (black).

3D
An option to use a 3D effect for the button-label when the mouse is over (or pressing) the button.  The default setting is Off (no effect). There are three options that can be used to 'turn on' the feature:  Color allows the applet to derive its own color for the 3D effect based on your selection for LabelFocusColor and LabelPressedColor; in this mode, if you used black text for either option, TextButton will use gray for the 3D effect.  The Color mode is recommended as the best place to start.  With some combinations of text/button colors, the Color mode will make the text hard to read (an example is LabelFocusColor 0000FF, ButtonColor 008000).  To get around this, two further modes are available: LightGray and DarkGray.  These allow you to choose one of two shades of gray to add effect without obscuring the text.  The sacrifice you make in these modes, however, is that the same shade of gray will be applied to both your LabelFocusColor and LabelPressedColor (that's why I suggest you start with Color mode!).

NOTE: This parameter is NOT case sensitive.  You can enter COLOR, or color, or even cOLoR.

Sound
Specifies whether or not you'd like the applet to play sounds in response to mouse-clicks.  A value of yes turns the sound option on, a value of no turns it off.  (The default value is no.)  You can also leave the whole 'Sound' parameter out altogether if you don't want to use sounds.  The inclusion of the yes/no option allows you to use sounds on one instance of the applet without having to use it on all.  For more info, see "Using Sounds" below.

NOTE: Once again, this parameter is NOT case sensitive.  Values of YES, yes or even yEs are okay.

URL
The URL of the page you want the applet to fetch when clicked.  This may be an absolute URL (http://www.doctors.co/operate) or a relative URL (../../MyPage.htm).  

Target
A text-string specifying the name of the frame or window in which you want the downloaded page to open.  The default is _top.

StatusMessage
A text-string you want displayed in the browser's status-bar when the mouse passes over the button, usually giving some clue to the linked page.  The default is Link to followed by the 'URL' value.

•	Using Sounds
TextButton supports sound, using the two audio files included in the zip archive (with the .au extension).  Place these files in the same directory as the class file (as indicated in your CODEBASE attribute).  If you don't want to use sounds, the audio files can be deleted or moved elsewhere with no error messages or explosions occurring.  Similarly, if you want to use only one of the sounds, just remove the file you don't want to use.

The names of the two files are fixed:  buttondown.au plays when the button is pressed, followed by buttonup.au when it's released.  If you'd like to replace these with your own files, go right ahead.  The only restrictions are that the files must be in Sun/NeXT format (.au), must be in the class directory (as noted by your codebase= attribute), and must use the filenames given here.

•	Usage Notes
If you click the button and then change your mind about linking to the URL, 'drag' the pointer out of the applet area before releasing the mouse button to cancel the action. (You can use this method to test your color-choices.)

Note that the button is hard-coded to fill the entire applet, with the button-label horizontally and vertically centered.  This means the button should always look good and will sit just as neatly on a background texture or wallpaper as a body-color.  Use HSPACE or VSPACE attributes if you need to create space between the button and anything else around it.

•	Version History
Version 1.0 -- 28 October 1996.

Version 1.1 -- 7 November 1996.  Added support for relative URLs.  Added a little extra code for smoother screen-display (offscreenGraphics for any Javarians reading this).

Version 1.2 -- 8 February 1997.  Added the "3D" text feature.

Version 2.0 -- 14th February 1997.  The applet now optionally makes agreeable noises when you click it (provided you upload the two .au files to the codebase directory).

•	Other Stuff
Although TextButton may be freely used on any non-commercial pages, I'd appreciate an email containing the URL.  Any comments or suggestions would be valued.

Rob
rob.young@btinternet.com
CodeBase
http://www.btinternet.com/~ry/CodeBase