All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ca.bc.europa.awt.ImageButton

java.lang.Object
   |
   +----java.awt.Component
           |
           +----ca.bc.europa.awt.ImageButton

public class ImageButton
extends Component
implements Runnable

The ImageButton class loads an image and makes a button out of it.

Up to three images are created from the original image, with the use of three ImageFilters. The three images are used to represent the three button states, mouse over, pressed, and released (default). For a nice button effect try the Buttonize filter. The Bright filter can be used to create a good mouse over effect.

An example input image:

See Also:
Component, Runnable

Constructor Index

 o ImageButton(Image, int, int)
Create and ImageButton.
 o ImageButton(Image, int, int, ImageFilter, ImageFilter, ImageFilter)
Create and ImageButton.
 o ImageButton(URL, int, int)
Create and ImageButton.
 o ImageButton(URL, int, int, ImageFilter, ImageFilter, ImageFilter)
Create and ImageButton.

Method Index

 o getPreferredSize()
Get the preferred size for the component.
 o paint(Graphics)
Draw the component.
 o run()
Retrieve and filter all image varients for the button.
 o setImage(Image)
Set a new image for the button.
 o update(Graphics)
Update the component.

Constructors

 o ImageButton
 public ImageButton(URL imageURL,
                    int w,
                    int h,
                    ImageFilter inFilter,
                    ImageFilter outFilter,
                    ImageFilter moFilter)
Create and ImageButton.

Parameters:
imageURL - A URL to an image that will be used as a basis for the button.
w - The width of the component, no image resize takes place.
h - The height of the component, no image resize takes place.
inFilter - An image filter used to create the pressed button look.
outFilter - An image filter used to create the relased button look.
moFilter - An image filter used to create a mouse over image.
 o ImageButton
 public ImageButton(URL imageURL,
                    int w,
                    int h)
Create and ImageButton.

Parameters:
imageURL - A URL to an image that will be used as a basis for the button.
w - The width of the component, no image resize takes place.
h - The height of the component, no image resize takes place.
 o ImageButton
 public ImageButton(Image image,
                    int w,
                    int h,
                    ImageFilter inFilter,
                    ImageFilter outFilter,
                    ImageFilter moFilter)
Create and ImageButton.

Parameters:
image - An image that will be used as a basis for the button.
w - The width of the component, no image resize takes place.
h - The height of the component, no image resize takes place.
inFilter - An image filter used to create the pressed button look.
outFilter - An image filter used to create the relased button look.
moFilter - An image filter used to create a mouse over image.
 o ImageButton
 public ImageButton(Image image,
                    int w,
                    int h)
Create and ImageButton.

Parameters:
image - An image that will be used as a basis for the button.
w - The width of the component, no image resize takes place.
h - The height of the component, no image resize takes place.

Methods

 o setImage
 public void setImage(Image image)
Set a new image for the button.

Parameters:
image - The new image.
 o getPreferredSize
 public Dimension getPreferredSize()
Get the preferred size for the component. Required for exact initial size.

Overrides:
getPreferredSize in class Component
See Also:
Component
 o update
 public void update(Graphics g)
Update the component.

Parameters:
g - the Graphics context.
Overrides:
update in class Component
See Also:
Component
 o paint
 public void paint(Graphics g)
Draw the component.

Parameters:
g - the Graphics context.
Overrides:
paint in class Component
See Also:
Component
 o run
 public synchronized void run()
Retrieve and filter all image varients for the button.


All Packages  Class Hierarchy  This Package  Previous  Next  Index