rabbit.awt
Class ImageComponent

java.lang.Object
  extended byjava.awt.Component
      extended byrabbit.awt.ImageComponent
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class ImageComponent
extends java.awt.Component

This class is a Component that holds an image.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ImageComponent(byte[] img)
          Create a new ImageComponent with the Image loaded from the given bytearray.
ImageComponent(byte[] img, int off, int len)
          Create a new ImageComponent with the Image loaded from the given bytearray.
ImageComponent(java.lang.String filename)
          Create a new ImageComponent with the Image loaded from the given filename.
 
Method Summary
 java.awt.Dimension getPreferredSize()
          Get the preferred size of this component, that is the size of the image.
 void paint(java.awt.Graphics g)
          Draw the image on the Graphics.
 void update(java.awt.Graphics g)
          Update the Graphics for this Component.
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, 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, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ImageComponent

public ImageComponent(java.lang.String filename)
Create a new ImageComponent with the Image loaded from the given filename.

Parameters:
filename - the name of the image file.

ImageComponent

public ImageComponent(byte[] img)
Create a new ImageComponent with the Image loaded from the given bytearray.

Parameters:
img - the bytearray of the image.

ImageComponent

public ImageComponent(byte[] img,
                      int off,
                      int len)
Create a new ImageComponent with the Image loaded from the given bytearray.

Parameters:
img - the bytearray of the image.
off - the starting offset of the image.
len - the length of the image.
Method Detail

getPreferredSize

public java.awt.Dimension getPreferredSize()
Get the preferred size of this component, that is the size of the image.

Returns:
the size of the image.

update

public void update(java.awt.Graphics g)
Update the Graphics for this Component.

Parameters:
g - the Graphics for this Component.

paint

public void paint(java.awt.Graphics g)
Draw the image on the Graphics.

Parameters:
g - the Graphics to draw the image on.