    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class org.w3c.tools.widgets.ImageButton

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

public class ImageButton
extends Canvas

##

currentImg
img1
img2
switchable

##

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

##

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

##

switchable

     protected boolean switchable

img1

     protected Image img1

img2

     protected Image img2

currentImg

     protected Image currentImg

##

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

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

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

ImageButton

     public ImageButton(Image img)

  Construct an ImageButton with no action command

  Parameters:
    img - The image of this ImageButton

##

initSize

     protected void initSize()

  Gets the size of the Image to calculate the minimum size of the Button

switchImage

     public void switchImage()

paint

     public void paint(Graphics g)

  paint the ImageButton in its initial shape

  Parameters:
    g - A Graphics
  Overrides:
    paint in class Canvas

paintShadow

     protected void paintShadow(boolean raised)

  paints the ImageButton using double buffering

  Parameters:
    raised - A boolean which shows the state of the button

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

getMinimumSize

     public Dimension getMinimumSize()

  Returns the minimum size of the ImageButton

  Overrides:
    getMinimumSize in class Component

getPreferredSize

     public Dimension getPreferredSize()

  Returns the preferred size of the ImageButton

  Overrides:
    getPreferredSize in class Component

setActionCommand

     public void setActionCommand(String command)

  Sets the action command String used when an ActionEvent is fired

  Parameters:
    command - The command String

getActionCommand

     public String getActionCommand()

  Returns the action command String

addActionListener

     public synchronized void addActionListener(ActionListener al)

  Adds an action listener to this ImageButton

  Parameters:
    al - The ActionListener

removeActionListener

     public synchronized void removeActionListener(ActionListener al)

  Removes an action listener to this ImageButton

  Parameters:
    al - The ActionListener

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