Class gjt.ImageButton
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class gjt.ImageButton

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----gjt.ImageButton

public class ImageButton
extends Canvas
An Image painted in a Canvas, bordered by a ThreeDRectangle.

ImageButtons have two constructors, both of which take an Image. The Image passed to the constructor must not be null; this is enforced by an assertion.

Default border thickness is 2 pixels - thickness may be set at construction time only.

Event handling is delegated to an ImageButtonController. By default, all ImageButtons are fitted with an instance of SpringyImageButtonController, however, setController(ImageButtonController) may be used to fit an ImageButton with a different derivation of ImageButtonController after construction.

ImageButtons ensure that their Images are completely loaded before they are displayed.

Drawn either raised or inset, current state may be queried via the isRaised() method.

disable() disables response to input and repaints the image with a bleached version. enable() restores the original image and enables response to input. The intensity of the bleaching effect may be controlled (for all ImageButtons) via the static setBleachPercent(int) method.

See Also:
ThreeDRectangle, ImageButtonController, ImageButtonEvent, SpringyImageButtonController, StickyImageButtonController, BleachImageFilter, ImageButtonTest

Constructor Index

 o ImageButton(Image)
 o ImageButton(Image, ImageButtonController)
 o ImageButton(Image, int, ImageButtonController)

Method Index

 o disable()
 o enable()
 o getBleachPercent(int)
 o getController()
 o isDisabled()
 o isInside(int, int)
 o isRaised()
 o minimumSize()
 o mouseDown(Event, int, int)
 o mouseDrag(Event, int, int)
 o mouseUp(Event, int, int)
 o paint(Graphics)
 o paintInset()
 o paintRaised()
 o preferredSize()
 o reshape(int, int, int, int)
 o resize(int, int)
 o setBleachPercent()
 o setController(ImageButtonController)
 o setImage(Image)

Constructors

 o ImageButton
  public ImageButton(Image image)
 o ImageButton
  public ImageButton(Image image,
                     ImageButtonController controller)
 o ImageButton
  public ImageButton(Image image,
                     int thickness,
                     ImageButtonController controller)

Methods

 o setBleachPercent
  public static int setBleachPercent()
 o getBleachPercent
  public static void getBleachPercent(int p)
 o setImage
  public void setImage(Image image)
 o minimumSize
  public Dimension minimumSize()
Overrides:
minimumSize in class Component
 o preferredSize
  public Dimension preferredSize()
Overrides:
preferredSize in class Component
 o isRaised
  public boolean isRaised()
 o isDisabled
  public boolean isDisabled()
 o enable
  public void enable()
Overrides:
enable in class Component
 o disable
  public void disable()
Overrides:
disable in class Component
 o resize
  public void resize(int w,
                     int h)
Overrides:
resize in class Component
 o reshape
  public void reshape(int x,
                      int y,
                      int w,
                      int h)
Overrides:
reshape in class Component
 o paint
  public void paint(Graphics g)
Overrides:
paint in class Canvas
 o paintInset
  public void paintInset()
 o paintRaised
  public void paintRaised()
 o isInside
  public boolean isInside(int x,
                          int y)
 o setController
  public void setController(ImageButtonController controller)
 o getController
  public ImageButtonController getController()
 o mouseDown
  public boolean mouseDown(Event event,
                           int x,
                           int y)
Overrides:
mouseDown in class Component
 o mouseUp
  public boolean mouseUp(Event event,
                         int x,
                         int y)
Overrides:
mouseUp in class Component
 o mouseDrag
  public boolean mouseDrag(Event event,
                           int x,
                           int y)
Overrides:
mouseDrag in class Component

All Packages  Class Hierarchy  This Package  Previous  Next  Index