Button Demo

The AWT does not provide picture buttons, but the excellent book, Mastering the AWT by David Geary shows how they can be implemented. Here I provide some extensions to these classes, and examples of their use. This code uses the Java 1.1 (and later) event model. It could be implemented for the 1.0.2 event model, but I have not done so.

I also provide an animated drawn button class, in which the button face is a custom drawing, such as a clock face or gauge, that is provided (and can be updated at any time) by the application.

This ButtonDemo.java applet demonstrates picture buttons, including the drawn button feature.
It may take a minute to load everything.

If you see this you cannot run applets.

Source

ButtonDemo.java
The demo applet.
ImageButton.java
By David Geary, base class for image buttons.
PushImageButton.java
By David Geary, image button extension with normal push behavior.
CheckImageButton.java
By David Geary, image button extension with push-on push-off behavior.
ImageButtonListener.java
By David Geary, base class state manager for button behaviors.
SpringyImageButtonListener.java
By David Geary, state manager extension for normal push behavior.
StickyImageButtonListener.java
By David Geary, state manager extension for push-on push-off behavior.
DrawImage.java
Base class for drawings as button faces.
WhiteBar.java
An example drawing as a button face, showing animation of the image.
ListenerAdder.java
A helper class that connects all controls to their controlled code.
BubbleHelper.java
Class that manages bubble help or tooltips for AWT components.
RadioGroup.java
Class that manages a radio set containing either CheckImageButtons or Checkboxes.
ButtonLike.java
The interface for ButtonLike classes,
ButtonLikeListener.java
The basic mouse listener for ButtonLike classes, after the ImageButtonListener by David Geary.
MomentaryButtonLikeListener.java
extends ButtonLikeListener for momentary behavior.
SpringyButtonLikeListener.java
extends ButtonLikeListener for springy behavior.
StickyButtonLikeListener.java
extends ButtonLikeListener for sticky behavior.

Other Java code and techniques...

Please also visit my home page.

Was this Helpful?

Was this Helpful? Was it what you were looking for? Are there links that I should include? Suggestions? How did you find this page? Please let me know. Email me at morris_hirsch@brown.edu

Legalities

This software is provided free of charge with no support. Email me at morris_hirsch@brown.edu if you do have a problem, and I will try to help, but I cannot promise to.

Except for all sections which are identified as the work, and copyright, of others, this work is Copyright (C) 1998 by Morris Hirsch. All rights reserved, except as granted here.

Redistribution and use in source and binary forms, with or without modification, for any purpose, are permitted, except as may be restricted by original copyright holders, provided that the following conditions are met:

DISCLAIMER

This software is provided free of charge with no support.
This software is provided in source format; You are advised to examine it and understand it, before putting it to use.
This software uses only algorithms and coding techniques that are available to the public in the open literature. You are however, advised to make your own determination of legality, for your intended use.
This software is provided by the Author and Contributors ``AS IS'' and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose, are disclaimed.
In no event shall the Author or Contributors, or their Agents, be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
1