Three State Button Applet
The Buttons applet allows users to create Java button bars (or single buttons) without knowing the Java programming language. The look and feel of this applet are configurable by the image used for displaying the buttons and by the use of parameters.
Here are some of the features supported by the applet: two layout options, mouse over, sound for button events, target frames, status bar display.
To use the applet, you need to create an image file representing the buttons. You can use the .jpg or .gif format. This file will contain the images of the buttons in their inactive, active, and pressed state.
Here is the image file used for the buttons above:
The whole image can be divided into three rows of equal height and into N rows of equal width (where N is the number of buttons in the image). The first row contains the image of the button in the inactive state. This image is displayed when the cursor is not over the button. The second row contains the image of the button in the active state and it's displayed when the cursor moves over the button. When the button is clicked, the image in the third row is displayed.
If the buttons are laid out vertically, the whole image has to be transposed; therefore, it will be made up of N rows and three columns, each column containing the image of a different state of each button.
The parameters for this applet are:
|buttonImage*||-||the image file.|
|buttonCount*||-||the number of buttons in the image file.|
|isHorizontal||-||true if the buttons are laid out horizontally, false if vertically. The default value is false.|
|moveSound||-||the sound file (.au format only) to play when moving the cursor from button to button.|
|clickSound||-||the sound file (.au format only) to play when clicking on a button.|
|buttonNInfo||-||the message displayed in the browser's status bar when the cursor is over button number N.|
|buttonNLink||-||the URL associated with button number N.|
|buttonNFrame||-||the target frame where the page specified by buttonNLink will be displayed.|
As an example, here are the parameters for the applet at the top of this page:
Using the Buttons applet with a vertical layout
Using the Buttons applet with frames
Download the Buttons applet (the file has the extension .class; some browsers will download the file as .exe, in which case you will have to change the extension manually back to .class)
Note: the applet will look best if
|for horizontal layout||-||the applet width is the same as the image width and the applet height is 1/3 of the image height|
|for vertical layout||-||the applet width is 1/3 of the image width and the applet height is the same as the image height|
Due to some clients' configuration, it might be necessary to use the web server ip address in your applet tag; therefore, your codebase will be, for example, codebase="http://18.104.22.168/gbortes/" instead of codebase="http://www.reocities.com/gbortes/"
For questions or comments, please send mail to email@example.com