jclass
Class ImageCanvas

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--jclass.ImageCanvas

public class ImageCanvas
extends java.awt.Canvas

Simple canvas for displaying simple images.

Written: Radu Sion
Version: 0.16x for 1.1.1 awt
Source: ImageCanvas.java

Visit Smart Software 

See Also:
Serialized Form

Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
ImageCanvas()
          Constructs a new object.
ImageCanvas(java.awt.Image im, int width, int height)
          Constructs a new object that will use the given image in drawing.
 
Method Summary
 java.awt.Image getImage()
          Returns the internal Image object of this Canvas.
 java.awt.Dimension getPreferredSize()
          should change this to reflect the real image sizes
 boolean imageUpdate(java.awt.Image img, int flags, int x, int y, int w, int h)
           
 void paint(java.awt.Graphics gr)
           
 void setImage(java.awt.Image img)
          Sets the new displayed image.
 
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, nableEvents, 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, 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
 

Constructor Detail

ImageCanvas

public ImageCanvas(java.awt.Image im,
                   int width,
                   int height)
Constructs a new object that will use the given image in drawing. No parameter checkings are done.
Parameters:
im - Image to assign to this canvas
width - Width to use
height - Height to use

ImageCanvas

public ImageCanvas()
Constructs a new object. This constructor should be followed rightaway by a call to .imageUpdate() in order to do something really useful. It does nothing right now.
Method Detail

imageUpdate

public boolean imageUpdate(java.awt.Image img,
                           int flags,
                           int x,
                           int y,
                           int w,
                           int h)
Overrides:
imageUpdate in class java.awt.Component

paint

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

getPreferredSize

public java.awt.Dimension getPreferredSize()
should change this to reflect the real image sizes
Overrides:
getPreferredSize in class java.awt.Component

setImage

public void setImage(java.awt.Image img)
Sets the new displayed image.
Parameters:
img - Image to set to this canvas object

getImage

public java.awt.Image getImage()
Returns the internal Image object of this Canvas.