All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class gjt.ImageButton

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

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

ImageButtons have two constructors, both of which take an Image, along with a default constructor. The Image passed to a constructor must not be null; this is enforced by assertions.

Using the default constructor creates an image button with no image specified. This is to allow flexibility when creating image buttons, but it should be noted that it's the developer's * responsibility to call setImage(Image) before the image button is painted, or an assertion will be thrown. Default border thickness is 2 pixels - thickness may be set at construction time only.

Event handling is delegated to an ImageButtonListener. By default, all ImageButtons are fitted with an instance of SpringyImageButtonListener, however, setListener(ImageButtonListener) may be used to fit an ImageButton with a different derivation of ImageButtonListener 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.

setEnabled(false) disables response to input and repaints the image with a black and white version. setEnabled(true) restores the original image and enables response to input.

See Also:
ThreeDRectangle, ImageButtonListener, SpringyImageButtonListener, StickyImageButtonListener, BleachImageFilter, ImageButtonTest

Constructor Index

 o ImageButton()
 o ImageButton(Image)
 o ImageButton(Image, int)
 o ImageButton(Image, int, ImageButtonListener)

Method Index

 o activate()
 o addActionListener(ActionListener)
 o arm()
 o disable()
Deprecated.
 o disarm()
 o enable()
Deprecated.
 o getBubbleInterval()
 o getDefaultThickness()
 o getListener()
 o getMinimumSize()
 o getPreferredSize()
 o isArmed()
 o isDisabled()
 o isInset()
 o isRaised()
 o minimumSize()
Deprecated.
 o paint(Graphics)
 o paintInset()
 o paintRaised()
 o preferredSize()
Deprecated.
 o processActionEvent()
 o removeActionListener(ActionListener)
 o reshape(int, int, int, int)
Deprecated.
 o resize(int, int)
Deprecated.
 o setArmed(boolean)
 o setBounds(int, int, int, int)
 o setBubbleHelp(String)
 o setBubbleInterval(long)
 o setDefaultThickness(int)
 o setEnabled(boolean)
 o setImage(Image)
 o setInset()
 o setListener(ImageButtonListener)
 o setRaised()
 o setSize(int, int)
 o setThickness(int)

Constructors

 o ImageButton
 public ImageButton()
 o ImageButton
 public ImageButton(Image image)
 o ImageButton
 public ImageButton(Image image,
                    int thickness)
 o ImageButton
 public ImageButton(Image image,
                    int thickness,
                    ImageButtonListener listener)

Methods

 o setDefaultThickness
 public static void setDefaultThickness(int defThickness)
 o getDefaultThickness
 public static int getDefaultThickness()
 o setBubbleHelp
 public void setBubbleHelp(String bubbleText)
 o setBubbleInterval
 public void setBubbleInterval(long interval)
 o getBubbleInterval
 public long getBubbleInterval()
 o activate
 public void activate()
 o arm
 public void arm()
 o disarm
 public void disarm()
 o setThickness
 public void setThickness(int thickness)
 o setArmed
 public void setArmed(boolean armed)
 o isArmed
 public boolean isArmed()
 o setImage
 public void setImage(Image image)
 o getListener
 public ImageButtonListener getListener()
 o setListener
 public void setListener(ImageButtonListener l)
 o minimumSize
 public Dimension minimumSize()
Note: minimumSize() is deprecated. as of JDK1.1

Overrides:
minimumSize in class Component
 o getMinimumSize
 public Dimension getMinimumSize()
Overrides:
getMinimumSize in class Component
 o preferredSize
 public Dimension preferredSize()
Note: preferredSize() is deprecated. as of JDK1.1

Overrides:
preferredSize in class Component
 o getPreferredSize
 public Dimension getPreferredSize()
Overrides:
getPreferredSize in class Component
 o isRaised
 public boolean isRaised()
 o setRaised
 public void setRaised()
 o isInset
 public boolean isInset()
 o setInset
 public void setInset()
 o isDisabled
 public boolean isDisabled()
 o enable
 public void enable()
Note: enable() is deprecated. as of JDK1.1

Overrides:
enable in class Component
 o disable
 public void disable()
Note: disable() is deprecated. as of JDK1.1

Overrides:
disable in class Component
 o setEnabled
 public void setEnabled(boolean enable)
Overrides:
setEnabled in class Component
 o resize
 public void resize(int w,
                    int h)
Note: resize() is deprecated. as of JDK1.1

Overrides:
resize in class Component
 o setSize
 public void setSize(int w,
                     int h)
Overrides:
setSize in class Component
 o reshape
 public void reshape(int x,
                     int y,
                     int w,
                     int h)
Note: reshape() is deprecated. as of JDK1.1

Overrides:
reshape in class Component
 o setBounds
 public void setBounds(int x,
                       int y,
                       int w,
                       int h)
Overrides:
setBounds in class Component
 o paint
 public void paint(Graphics g)
Overrides:
paint in class Component
 o paintInset
 public void paintInset()
 o paintRaised
 public void paintRaised()
 o processActionEvent
 public void processActionEvent()
 o addActionListener
 public synchronized void addActionListener(ActionListener listener)
 o removeActionListener
 public synchronized void removeActionListener(ActionListener listener)

All Packages  Class Hierarchy  This Package  Previous  Next  Index