ModernJava
http://www.modernminds.com
H ow the Applet Creates Button Images

For the best looking buttons, you should ideally create a button bar image for each button state. Unfortunately, this is usually not practical. Not only does it take time to create a button bar image for each and every button state, but it also increases the amount of data that the applet must retrieve when it is initializing. On an intranet, this might not be an issue, but transfer speeds on the Internet are typically much slower, and the more image files that the applet must load the slower the initialization process will be.

In order to relieve some of the burden of image file creation from the button bar designer, and in order to lower the image loading bandwidth requirements, the Ultimate Button BarTM will automatically create, or synthesize, images for button states where a predefined image file for the button state does not exist.

Here is what the Ultimate Button BarTM does to create an image for button states with no image file (note that it might not be possible to specify an image file for some of these button states, depending upon the applet's implementation):


"base" Button State

This is the image that is displayed when a active button is "at rest" (i.e., the mouse is not within the button's boundaries). An "active" button is a button that is not disabled.

An image file for the "base" button state must always be specified, so Ultimate Button BarTM will never automatically create an image for this state.
"mouseOver" Button State

This is the image that is displayed when the mouse is moved within an active button's boundaries, and when the button is not "stuck" down ("sticky" buttons do not apply to applets).

If an image file is not specified for this button state, then the "base" image file is used for the "mouseOver" button state, and a grayscale version of the "base" image file is created for use as the new "base" image.
"mouseOver2" Button State

The "mouseOver2" image file is not really a button state, but rather is the second frame of animation for animated buttons.

A "mouseOver2" image is never synthesized: if the image file is missing, then no animation will take place for the buttons on the button bar.
"mouseDown" Button State

The "mouseDown" button image is displayed when the mouse button is clicked while within the boundaries of an active button on the button bar. The "mouseDown" image is displayed as long as the mouse button continues to be held down.

If an image file for the "mouseDown" button state is not specified, and if borders are drawn for the buttons, then the button will be drawn with an inverse border (to give the illusion that the button has been depressed). If borders are not drawn for the buttons, then the "mouseOver" image will be brightened (or "lightened") and used as the "mouseDown" image.
"mouseDownOver" Button State

This state does not apply to applets.

The "mouseDownOver" state is when a "sticky" button is "stuck" down and the mouse is moved within the button's boundaries.

If an image file is not specified for the "mouseDownOver" button state, then the "mouseDown" image is brightened (or lightened).
"buttonsDisabled" Button State

This is the image that is displayed when a button is disabled.

If an image file for the "buttonsDisabled" button state is not provided, then the "buttonsDisabled" image will be created by darkening (or "dimming") the "base" button image.

Note that you can override the automatic creation of an image for a button state with an existing image file. For instance, if you are not using a "mouseOver" image but you do not want the Ultimate Button BarTM to create a grayscale image for the "base" button state (i.e., you want to use the "base" image file for both the "base" state and the "mouseOver" state), then you can simply specify the "base" image file for the "mouseOver" image file too. The Ultimate Button BarTM is smart enough to realize that it should not load the "base" image file twice, but rather it will load the image file once and use it internally twice: once for the "base" state and once for the "mouseOver" state.
Copyright © 1997 by Modern Minds, Inc.