The Parameters Explained             

Each of TextButton's parameters is explained below, with reference to the clickable example code in the left frame: you can click a parameter from the example code to jump to its explanation, or simply read this page from top to toe. As you read, click the red references to other parameters to jump to them.

Most of TextButton's parameters have a default setting which is mentioned below. If the default setting is the option you'd like to use in your own implementation, you can leave that parameter out of your HTML code.


Applet Width & Height
However you adjust the applet dimensions, TextButton will always fill the entire applet area, so there is no problem in slotting it seamlessly into a web-page's wallpaper. If you opt to autowrap the text on the button, altering the size significantly will alter the layout of text.

If you use a background image, bear in mind that this will be scaled to your applet dimensions, which may produce unusual results. When using a BgImage, it's preferable to match the applet dimensions to those of the image, and/or to use image-editing software to resample the image.

ButtonColor
Hex triplet for the color of the button. By default this is a 3D button. If you use that default (by leaving Button3D set at 'yes', 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 color is 008000 (mid-green).

ButtonFocusColor
Another hex triplet for the color of the button when the mouse moves over it or clicks it. Bear in mind that when the button is clicked, a much darker derivation of this color is used, so the result will be less effective if you start with a very dark color. This parameter defaults to the same color you chose for ButtonColor, saving the need to enter it if you don't want your button to change color.

Button3D
A simple yes or no parameter, and these values are not case sensitive. For compatibility with earlier versions the default is 'yes', providing a 3D button. If you want the button to blend into your page's background color so that only the text is visible, add the parameter with the value 'no'.

BgImage
Allows a background GIF or JPEG image to be used as the background for the button. Note that the image you choose will automatically be scaled to match the applet dimensions. You'll also get best results by setting the Button3D parameter to 'no' to prevent bright outlines appearing above or below the image. If you use a GIF image with a transparency setting, the transparent color will be replaced by your choice of ButtonColor.

Font
A comma-delimited string giving the name, style and size of the font you want to use for the Label. The default settings are Helvetica, in bold, at size 13, which would be written as Helvetica,bold,13. Two important things to note: first, there must be no spaces in this entry; second, the three items must appear in the order name,style,size. Note that the style part of this setting can be plain, bold, italic or bolditalic, and these are not case-sensitive.

Label
The text you want to appear on the button. The default is no text. How the text will be displayed will depend upon its length (ie. whether it requires more than one line at your chosen applet width), and the settings you choose for the AutoWrap and Align parameters.

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

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

LabelPressedColor
The color of the 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 value 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 selections 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 we suggest you start with Color mode!).

NOTE: As usual, this parameter is not case sensitive. You can enter COLOR, or color, or even cOLoR.

Align
Sets the alignment of text on the button when your Label consists of multiple lines. (With AutoWrap turned off and a single line of text entered as a label, TextButton will ignore your Align setting and center the label both horizontally and vertically.) The options for the Align parameter are center or left, once again not case-sensitive. The default is center.

Delimiter
With the AutoWrap function switched off, a very long Label might just vanish off the side of your button (unless you've got a very long button too!). You can force this label to wrap onto new lines by entering a delimiter symbol at those places where you want a line break to occur. This parameter lets you choose the symbol you want to use for the job. By default, the pipe symbol | is used. The only reason you'd want to change this is if you need to use this symbol as part of the displayed text on the button, which seems unlikely to happen. Therefore, this parameter can almost always be left out.

Here's a quick example of using the delimiter to wrap text yourself (after turning off AutoWrap):

This piece of text|wraps to the next line|wherever the pipe symbol|appears.| |You can even miss out lines!

which would look like this (assuming that Align is set to 'left'):

This piece of text
wraps to the next line
wherever the pipe symbol
appears.
 
You can even miss out lines.

Note that if you want to miss out a line, you must enter a space between the two delimiters (as shown above). If a delimiter symbol is used and no printable character follows it, the applet will give error messages and get all sulky.

AutoWrap
The options are yes or no, and the value is not case-sensitive. The default is no. Setting the value to yes will wrap your Label onto new lines, based on the size of the font you chose and the current applet width (less a fixed 10-pixel margin left and right). If AuroWrap is switched on, the Delimiter parameter is ignored; if you happen to include your chosen delimiter symbol somewhere in the label, it will simply be printed on the button along with the other text. To create a simple button-label consisting of a single-line of text, set the AutoWrap parameter to no (or leave it out entirely), and adjust the height and width of the applet to suit the size of font and length of text - the label will automatically be centered horizontally and vertically on the button. (Yes, TextButton is smart enough to know what to do when you enter just a single line of text!)

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. Neither is case-sensitive. The default value is no, which means that you can also leave the Sound parameter out if you don't want to use sounds. The inclusion of this yes/no option allows you to use sounds on one instance of the applet without having to use it on all if you have several TextButtons on a page. With this parameter set to 'yes', you'll need to specify which sound to use, via the two following parameters.

SoundButtonDown
Specifies the path (if necessary) and name of the Sun/NeXT format (.au) audio file to be played when the TextButton is clicked. The location of the file is treated exactly as a URL: you might enter only a filename (if the file is in the current directory), a relative location (such as ../sounds/daftsound.au) or an absolute location (such as http://www.server.com/folder/subfolder/daftsound.au). See the note about Using Sounds, below.

SoundButtonUp
Specifies the path (if necessary) and name of the audio file to be played when the TextButton is released. The same details apply to this parameter as apply to SoundButtonDown, of course.

NOTE - Using Sounds: TextButton is forgiving in its sound-support. If you set the Sound parameter to 'yes', and then forget to include one or both of the two parameters above (or forget to upload the audio files!), TextButton will continue quite happily (but silently). This means that if you choose to use only one of the two possible sounds, you can simply remove its parameter and TextButton will play sounds only for the event that has a parameter.

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). Note that although Java does support #name anchors appended to URLs (to link to particular parts of a page), not all browsers will react correctly to it, so its use is generally best avoided.

As an aid to color and sound testing, you can prefix or replace your URL parameter value with the dollar sign $ to prevent TextButton linking anywhere when clicked.

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.

Message
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 blank (no message displayed).


































.