PanelConfiguration
Class ImageCanvas

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--PanelConfiguration.ImageCanvas
Direct Known Subclasses:
HelpImageCanvas

public class ImageCanvas
extends Canvas
implements ComponentListener

This class provides a canvas in order to paint an image on it.

Version:
1.0
Author:
Sebastien baehni
See Also:
Serialized Form

Field Summary
protected  Image currentImage
          The current image (it changes when the image is resized).
protected  Image image
          The initial image.
protected  boolean painted
          A boolean to prevent java form drawing an unitialized image.
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
ImageCanvas()
          The constructor.
 
Method Summary
 void componentHidden(ComponentEvent e)
          When the component is hidden.
 void componentMoved(ComponentEvent e)
          When the component is moved.
 void componentResized(ComponentEvent e)
          When the component is resized.
 void componentShown(ComponentEvent e)
          When the component is shown.
 void init(Image image)
          The initialization method.
 void paint(Graphics g)
          The paint method.
 void update()
          This method take in account it the user is resizing the applet.
 void update(Image image)
          This method update the image that is shown in the canvas.
 
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, 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

image

protected Image image
The initial image.

currentImage

protected Image currentImage
The current image (it changes when the image is resized).

painted

protected boolean painted
A boolean to prevent java form drawing an unitialized image.
Constructor Detail

ImageCanvas

public ImageCanvas()
The constructor. Do nothing.
Method Detail

init

public void init(Image image)
The initialization method.
Parameters:
image - The image we want to paint on the canvas.

update

public void update()
This method take in account it the user is resizing the applet. If it is then we resize the image.

update

public void update(Image image)
This method update the image that is shown in the canvas.
Parameters:
image - The image that we must show in the cavnas.

paint

public void paint(Graphics g)
The paint method. We draw the image on a graphic.
Parameters:
g - The graphics context.
Overrides:
paint in class Canvas
See Also:
Graphics

componentHidden

public void componentHidden(ComponentEvent e)
When the component is hidden.
Specified by:
componentHidden in interface ComponentListener
Parameters:
e - The ComponentEvent

componentMoved

public void componentMoved(ComponentEvent e)
When the component is moved.
Specified by:
componentMoved in interface ComponentListener
Parameters:
e - The ComponentEvent

componentResized

public void componentResized(ComponentEvent e)
When the component is resized.
Specified by:
componentResized in interface ComponentListener
Parameters:
e - The ComponentEvent

componentShown

public void componentShown(ComponentEvent e)
When the component is shown.
Specified by:
componentShown in interface ComponentListener
Parameters:
e - The ComponentEvent