All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class w3c.tools.widgets.ImageButton

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----w3c.tools.widgets.ImageButton

public class ImageButton
extends Canvas

Variable Index

 o currentImg
 o img1
 o img2
 o switchable

Constructor Index

 o ImageButton(Image)
Construct an ImageButton with no action command
 o ImageButton(Image, Image)
Construct an ImageButton with the specified action command
 o ImageButton(Image, Image, String)
Construct an ImageButton with the specified action command
 o ImageButton(Image, String)
Construct an ImageButton with the specified action command

Method Index

 o addActionListener(ActionListener)
Adds an action listener to this ImageButton
 o fireActionEvent()
fire a new ActionEvent and process it, if some listeners are listening
 o getActionCommand()
Returns the action command String
 o getMinimumSize()
Returns the minimum size of the ImageButton
 o getPreferredSize()
Returns the preferred size of the ImageButton
 o imageUpdate(Image, int, int, int, int, int)
called when more informations about the image are available.
 o initSize()
Gets the size of the Image to calculate the minimum size of the Button
 o paint(Graphics)
paint the ImageButton in its initial shape
 o paintShadow(boolean)
paints the ImageButton using double buffering
 o removeActionListener(ActionListener)
Removes an action listener to this ImageButton
 o setActionCommand(String)
Sets the action command String used when an ActionEvent is fired
 o switchImage()

Variables

 o switchable
 protected boolean switchable
 o img1
 protected Image img1
 o img2
 protected Image img2
 o currentImg
 protected Image currentImg

Constructors

 o ImageButton
 public ImageButton(Image img1,
                    Image img2,
                    String command)
Construct an ImageButton with the specified action command

Parameters:
img1 - The image of this ImageButton
img2 - The image of this ImageButton
command - The action command String
 o ImageButton
 public ImageButton(Image img1,
                    Image img2)
Construct an ImageButton with the specified action command

Parameters:
img1 - The image of this ImageButton
realesed - The image of this ImageButton
 o ImageButton
 public ImageButton(Image img,
                    String command)
Construct an ImageButton with the specified action command

Parameters:
img - The image of this ImageButton
command - The action command String
 o ImageButton
 public ImageButton(Image img)
Construct an ImageButton with no action command

Parameters:
img - The image of this ImageButton

Methods

 o initSize
 protected void initSize()
Gets the size of the Image to calculate the minimum size of the Button

 o switchImage
 public void switchImage()
 o paint
 public void paint(Graphics g)
paint the ImageButton in its initial shape

Parameters:
g - A Graphics
Overrides:
paint in class Canvas
 o paintShadow
 protected void paintShadow(boolean raised)
paints the ImageButton using double buffering

Parameters:
raised - A boolean which shows the state of the button
 o imageUpdate
 public boolean imageUpdate(Image img,
                            int flaginfo,
                            int x,
                            int y,
                            int width,
                            int height)
called when more informations about the image are available. When the size is available, the ImageButton notifies its container that the size may have changed.

Overrides:
imageUpdate in class Component
See Also:
ImageObserver
 o getMinimumSize
 public Dimension getMinimumSize()
Returns the minimum size of the ImageButton

Overrides:
getMinimumSize in class Component
 o getPreferredSize
 public Dimension getPreferredSize()
Returns the preferred size of the ImageButton

Overrides:
getPreferredSize in class Component
 o setActionCommand
 public void setActionCommand(String command)
Sets the action command String used when an ActionEvent is fired

Parameters:
command - The command String
 o getActionCommand
 public String getActionCommand()
Returns the action command String

 o addActionListener
 public synchronized void addActionListener(ActionListener al)
Adds an action listener to this ImageButton

Parameters:
al - The ActionListener
 o removeActionListener
 public synchronized void removeActionListener(ActionListener al)
Removes an action listener to this ImageButton

Parameters:
al - The ActionListener
 o fireActionEvent
 protected void fireActionEvent()
fire a new ActionEvent and process it, if some listeners are listening


All Packages  Class Hierarchy  This Package  Previous  Next  Index