Java Cup Winner: Applet Toolkit & ImageButtonApplet
IMAGEBUTTONAPPLET
SAMPLES
This page describes a set of reusable classes I developed and sample implementations of them to create a variety of types of active pushbuttons with images and animations on them. My basic design approach was to put as much behavior as possible in classes that could be used in either applets or standalone applications and then wrap them in applet classes which implement all the applet-specific functionality. Each class has been documented using javadoc.

Components on this Page
-
Sample Implementations
-

-
ImageButton
-
This is the class that implements the basic button behavior. It can display an image and a text label on any side of the image. The button can be programmatically disabled; when disabled the image will be converted to a grayed-out version. The action to be performed when the button is pressed should be defined by the class that inherits from this class. This class is suitable for use in standalone Java programs.
-
-
ImageButtonApplet
-
This is the appletized version of ImageButton. It supports all applet-specific behavior and allows many of its options to be configured through applet parameters. Additionally, a URL to jump to when the button is pressed can be supplied as an applet parameter.
-
-
AnimatedImageButton
-
This class supports the display of animation sequences on a button. It extends ImageButton by managing the animation in a separate thread and feed new images to ImageButton. All the other functionality of ImageButton is preserved. This class is suitable for use in standalone Java programs.
-
-
AnimatedImageButtonApplet
-
This is the appletized version of AnimatedImageButton. It supports all applet-specific behavior and allows many of its options to be configured through applet parameters. Additionally, a URL to jump to when the button is pressed can be supplied as an applet parameter.
-
-
DualImageButtonApplet
-
This applet is a special implementation of AnimatedImageButtonApplet. It is basically an AnimatedImageButtonApplet with 2 images only.
-
-
Complete Package Documentation & Code
-
These are all the classes that support the creation of the above. They are general enough to be of use in a wide variety of new implementations. For example, the StdApplet and AppletParamParser classes implement behavior that would be useful to any applet writer.
-
spt.applets
-
spt.applets.AnimatedImageButtonApplet [Doc] [Code]
-
spt.applets.AppletParamParser [Doc] [Code]
-
spt.applets.DualImageButtonApplet [Doc] [Code]
-
spt.applets.ImageButtonApplet [Doc] [Code]
-
spt.applets.StdApplet [Doc] [Code]
-
spt.gui
-
spt.gui.AnimatedImageButton [Doc] [Code]
-
spt.gui.BorderedComponent [Doc] [Code]
-
spt.gui.ImageButton [Doc] [Code]
-
spt.gui.ImagePanel [Doc] [Code]
-
spt.gui.Rectangle3D [Doc] [Code]
-
spt.util
-
spt.util.StringUtil [Doc] [Code]

-
Samples: ImageButtonApplet
-
These are basic single image buttons with and without labels. The third button has a target URL set so it will take you there when pressed. The first two buttons have no action on them set. The second button, however, has an audio URL associated with it so it will make a sound when pressed. The enable/disable radio buttons apply to the first button and can be used to show how the button behaves when disabled.

-
Samples: DualImageButtonApplet
-
Both of these buttons should show one image when inactive and another when the mouse enters them. The second buttons shows what a borderless button looks like. Neither is configured to do anything when pressed.

-
Samples: AnimatedImageButtonApplet
-
Both these buttons will animate when the mouse is moved over them. The first button will do nothing when pressed. The second is a new take on a familiar button.
Development Note:
Windows 95 is the primary OS I developed this code under. I have tested it under Windows 95, NT and Solaris 2.4.
All testing/development was done with appletviewer, Netscape 2.0 and a little bit with 2.01 which came out just before I submitted this.
Copyright © 1996, Shaun Terry/ Homepage.