iicm.widgets
Class ImageButton

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--iicm.widgets.ImageButton
Direct Known Subclasses:
PictureButton

public class ImageButton
extends java.awt.Canvas

ImageButton - image button

See Also:
Serialized Form

Field Summary
protected  ImageButtonGroup group_
           
protected  int height_
           
protected  java.awt.Image img_
           
protected  java.lang.String label_
           
protected  boolean state_
           
protected  int width_
           
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
ImageButton(java.lang.String label, java.awt.Image img, int width, int height, boolean state, ImageButtonGroup group)
          constructor
 
Method Summary
 ImageButtonGroup getGroup()
           
 boolean getState()
           
 java.awt.Dimension minimumSize()
           
 boolean mouseDown(java.awt.Event evt, int x, int y)
           
 void paint(java.awt.Graphics g)
           
 java.awt.Dimension preferredSize()
           
 void setState(boolean value)
           
static java.awt.Image subimage(java.awt.Image img, int x, int y, int w, int h, java.awt.Component target)
          small helper to crop a subimage area out of an image. will wait until cropping has been completed when target is non-null.
 void update(java.awt.Graphics g)
           
static boolean waitForImage(java.awt.Image img, java.awt.Component target)
          small helper to wait until an image is completely loaded
 
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, getMinimumSize, getName, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, 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, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

label_

protected java.lang.String label_

img_

protected java.awt.Image img_

width_

protected int width_

height_

protected int height_

state_

protected boolean state_

group_

protected ImageButtonGroup group_
Constructor Detail

ImageButton

public ImageButton(java.lang.String label,
                   java.awt.Image img,
                   int width,
                   int height,
                   boolean state,
                   ImageButtonGroup group)
constructor
Parameters:
label - label used when img is null
width - image width, substituted by label width when img is null
height - allows uniform button height if some images are not available, width determined from image or label
state - initial state flag
group - ImageButtonGroup for radio buttons, null for toggle buttons
Method Detail

subimage

public static java.awt.Image subimage(java.awt.Image img,
                                      int x,
                                      int y,
                                      int w,
                                      int h,
                                      java.awt.Component target)
small helper to crop a subimage area out of an image. will wait until cropping has been completed when target is non-null.

waitForImage

public static boolean waitForImage(java.awt.Image img,
                                   java.awt.Component target)
small helper to wait until an image is completely loaded
Returns:
flag whether all was ok

minimumSize

public java.awt.Dimension minimumSize()
Overrides:
minimumSize in class java.awt.Component

preferredSize

public java.awt.Dimension preferredSize()
Overrides:
preferredSize in class java.awt.Component

update

public void update(java.awt.Graphics g)
Overrides:
update in class java.awt.Component

paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class java.awt.Canvas

mouseDown

public boolean mouseDown(java.awt.Event evt,
                         int x,
                         int y)
Overrides:
mouseDown in class java.awt.Component

setState

public void setState(boolean value)

getState

public boolean getState()

getGroup

public ImageButtonGroup getGroup()