Modern Java
http://www.modernminds.com
S ticky Button Bar

These text based button bars illustrates the use of "sticky" buttons. "Sticky" buttons are buttons that when clicked do not pop-up until another button is clicked. This type of button is useful for providing the visitors navigating your site with a visual clue of the page or section that they last selected.

The only difference between the two button bars is that the button bar on the left uses the mouseDownBrighten and mdBrightenTint parameters, while the button bar on the right uses the mouseOverBrighten and moBrightenTint parameters.

Try moving your mouse over the buttons and clicking on the buttons (clicking on the buttons will not cause a URL to load in this example). Note that in actual use, a "sticky button" button bar should be in its own frame.
If the Java class files are located in the same directory as the HTML, then the complete applet tag for the applet on the left would be defined as illustrated below. Click on the PARAM name for detailed information about the parameter.

<APPLET CODE="TextURLButtonBar.class" WIDTH="90" HEIGHT="112">
<PARAM NAME="disableBadURL" VALUE="false">
<PARAM NAME="stick" VALUE="2">
<PARAM NAME="mouseDownBrighten" VALUE="-10">
<PARAM NAME="mdBrightenTint" VALUE="004444">
<PARAM NAME="buttonBorders" VALUE="all">
<PARAM NAME="borderSize" VALUE="2">
<PARAM NAME="downShift" VALUE="true">
<PARAM NAME="downShiftAmt" VALUE="1">
<PARAM NAME="embossBase" VALUE="true">
<PARAM NAME="embossContrast" VALUE="19">
<PARAM NAME="embossBrightness" VALUE="170">
<PARAM NAME="color" VALUE="7D3B9D">
<PARAM NAME="fontColor" VALUE="76ABD9">
<PARAM NAME="fontSize" VALUE="14">
<PARAM NAME="fontStyle" VALUE="bold">
<PARAM NAME="button1Text" VALUE="Home">
<PARAM NAME="button1TextOver" VALUE="Home">
<PARAM NAME="button1Start" VALUE="0">
<PARAM NAME="button1Size" VALUE="28">
<PARAM NAME="button2Text" VALUE="Java">
<PARAM NAME="button2Start" VALUE="28">
<PARAM NAME="button2Size" VALUE="28">
<PARAM NAME="button3Text" VALUE="Links">
<PARAM NAME="button3Start" VALUE="56">
<PARAM NAME="button3Size" VALUE="28">
<PARAM NAME="button4Text" VALUE="Contacts">
<PARAM NAME="button4Start" VALUE="84">
<PARAM NAME="button4Size" VALUE="28">
</APPLET>

The applet tag for the applet on the right is identical, with the exception that the parameters

<PARAM NAME="mouseDownBrighten" VALUE="-10">
<PARAM NAME="mdBrightenTint" VALUE="004444">

have been replaced with the parameters

<PARAM NAME="mouseOverBrighten" VALUE="-10">
<PARAM NAME="moBrightenTint" VALUE="004444">
N otes on the Applet Parameters
The height and width values in the applet tag determine the height and width of button bar.
The stick parameter enables the "sticky button" behavior and also determines the number of the button that will initially be "stuck" in the buttonDown position when the applet is initialized.
The button bar uses a little trick to create the "mouseOver" image. In this example, there are no special attributes for the "mouseOver" button state -- it is identical to the "base" button state. Since there is no difference between the two states, the applet uses the base state for the mouseOver state (in addition to using it for the base state). Since we told the applet to emboss the base state, it follows that the mouseOver state will also appear embossed (since both states use the same image). By default, the applet converts the base state to grayscale so we end up with an embossed grayscale image for the base state, and an embossed normal (non-grayscale) image for the mouseOver state.

In this instance, we do not want an embossed image for the mouseOver state -- we would prefer to have a regular image instead. In order to do this, we "trick" the applet into creating a normal image by using the "button1TextOver" parameter and assigning it the same text as the "button1Text" parameter. This forces the applet to create a normal (un-embossed) mouseOver button image.

Most of the time you will not need this little trick, but it doesn't hurt to keep it in mind for the times that it could be useful.
The applet shown above on the right uses the mouseOverBrighten and moBrightenTint parameters to create the mouseOver button images.

The tint color used to create the mouseOver button images is a blue-green color that looks rather ugly by itself, but when the color value is added to the colors in the button bar image, a pleasant range of blues results.

The point to remember is that sometimes color combinations may produce unexpected results. The secret to successful tinting is to note that the tint color is always added to the color of each pixel in the button bar image.
The applet shown above on the left (i.e., the applet that uses the mouseDownBrighten and mdBrightenTint parameters) uses a trick in order to create the highlighted mouseDownOver button images without altering the standard un-highlighted mouseDown button images.

Remember that if button borders are drawn for the mouseDown state, then the mouseDownBrighten and mdBrightenTint parameters are ignored (unless the mdBrightenAll parameter is set to true). This causes the mouseDown buttons to be drawn using the same colors as the base button bar buttons. The mouseDownOver images, however, are created by "brightening" and "tinting" the mouseDown buttons. The net result of this is that the mouseDown image is brightened using the mouseDownBrighten and mdBrightenTint parameters to create the "brightened" and "tinted" mouseDownOver button images.
The disableBadURL parameter is used so that you can click the buttons without having a page load over the example. Normally you would want to specify URLs for the buttons and omit the disableBadURL parameter.
Copyright © 1997 by Modern Minds, Inc.