## org.w3c.tools.widgets
Class ImageButton

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

public class ImageButton
extends java.awt.Canvas

See Also:
  Serialized Form

Field Summary
`protected java.awt.Image` `currentImg`
`protected java.awt.Image` `img1`
`protected java.awt.Image` `img2`
`protected boolean` `switchable`

Fields inherited from class java.awt.Component
`BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT`

Constructor Summary
`ImageButton(java.awt.Image img)` Construct an ImageButton with no action command
`ImageButton(java.awt.Image img1, java.awt.Image img2)` Construct an ImageButton with the specified action command
`ImageButton(java.awt.Image img1, java.awt.Image img2, java.lang.String command)` Construct an ImageButton with the specified action command
`ImageButton(java.awt.Image img, java.lang.String command)` Construct an ImageButton with the specified action command

Method Summary
`void` `addActionListener(java.awt.event.ActionListener al)` Adds an action listener to this ImageButton
`protected void` `fireActionEvent()` fire a new ActionEvent and process it, if some listeners are listening
`java.lang.String` `getActionCommand()` Returns the action command String
`java.awt.Dimension` `getMinimumSize()` Returns the minimum size of the ImageButton
`java.awt.Dimension` `getPreferredSize()` Returns the preferred size of the ImageButton
`boolean` `imageUpdate(java.awt.Image img, int flaginfo, int x, int y, int width, int height)` called when more informations about the image are available.
`protected void` `initSize()` Gets the size of the Image to calculate the minimum size of the Button
`void` `paint(java.awt.Graphics g)` paint the ImageButton in its initial shape
`protected void` `paintShadow(boolean raised)` paints the ImageButton using double buffering
`void` `removeActionListener(java.awt.event.ActionListener al)` Removes an action listener to this ImageButton
`void` `setActionCommand(java.lang.String command)` Sets the action command String used when an ActionEvent is fired
`void` `switchImage()`

Methods inherited from class java.awt.Canvas
`addNotify`

Methods inherited from class java.awt.Component

`action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### switchable

    protected boolean switchable

### img1

    protected java.awt.Image img1

### img2

    protected java.awt.Image img2

### currentImg

    protected java.awt.Image currentImg

Constructor Detail

### ImageButton

    public ImageButton(java.awt.Image img1,
                       java.awt.Image img2,
                       java.lang.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(java.awt.Image img1,
                       java.awt.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(java.awt.Image img,
                       java.lang.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(java.awt.Image img)

  Construct an ImageButton with no action command
  Parameters:
    `img` - The image of this ImageButton

Method Detail

### 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(java.awt.Graphics g)

  paint the ImageButton in its initial shape
  Overrides:
    paint in class java.awt.Canvas
  Parameters:
    `g` - A Graphics

### 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(java.awt.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 java.awt.Component
  See Also:
    `ImageObserver`

### getMinimumSize

    public java.awt.Dimension getMinimumSize()

  Returns the minimum size of the ImageButton
  Overrides:
    getMinimumSize in class java.awt.Component

### getPreferredSize

    public java.awt.Dimension getPreferredSize()

  Returns the preferred size of the ImageButton
  Overrides:
    getPreferredSize in class java.awt.Component

### setActionCommand

    public void setActionCommand(java.lang.String command)

  Sets the action command String used when an ActionEvent is fired
  Parameters:
    `command` - The command String

### getActionCommand

    public java.lang.String getActionCommand()

  Returns the action command String

### addActionListener

    public void addActionListener(java.awt.event.ActionListener al)

  Adds an action listener to this ImageButton
  Parameters:
    `al` - The ActionListener

### removeActionListener

    public void removeActionListener(java.awt.event.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