gov.lanl.IDViewer
Class ImageCanvas

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--gov.lanl.IDViewer.ImageCanvas
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class ImageCanvas
extends java.awt.Canvas

The class ImageCanvas implements a display canvas for images.

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
ImageCanvas(java.awt.Image im)
          constructs an image canvas for a given image
ImageCanvas(java.awt.Image im, boolean icon)
          creates an image canvas for a given image and resizes it to icon size if necessary
ImageCanvas(java.awt.Image im, int x, int y)
          constructs an image canvas of a specified size
ImageCanvas(java.net.URL base, java.lang.String ref)
          creates an ImageCanvas from the image at this URL, full size
ImageCanvas(java.net.URL base, java.lang.String ref, boolean icon)
          creates an ImageCanvas from the image at this URL, icon size
 
Method Summary
 int getHeight()
          gets the height of the image displayed on the canvas
 int getWidth()
          gets the width of the image displayed on the canvas
 void paint(java.awt.Graphics g)
          draws the image in the canvas
 void reset(java.awt.Image im)
          changes the image displayed on the canvas and repaints the image canvas
 void reset(java.awt.Image im, int x, int y)
          changes the image displayed on the canvas, resizes the images, and repaints the image canvas
 void update(java.awt.Graphics g)
          overwrites the component updates to prevent erasing, i.e., flickering
 
Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, 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, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ImageCanvas

public ImageCanvas(java.net.URL base,
                   java.lang.String ref)
creates an ImageCanvas from the image at this URL, full size

Parameters:
base - the base URL
ref - the image filename from the base URL

ImageCanvas

public ImageCanvas(java.net.URL base,
                   java.lang.String ref,
                   boolean icon)
creates an ImageCanvas from the image at this URL, icon size

Parameters:
base - the base URL
ref - the image filename from the base URL
icon - if true resize for icon

ImageCanvas

public ImageCanvas(java.awt.Image im)
constructs an image canvas for a given image

Parameters:
im - the image

ImageCanvas

public ImageCanvas(java.awt.Image im,
                   int x,
                   int y)
constructs an image canvas of a specified size

Parameters:
im - the image to use
x - the size in the x direction
y - the size in the y direction

ImageCanvas

public ImageCanvas(java.awt.Image im,
                   boolean icon)
creates an image canvas for a given image and resizes it to icon size if necessary

Parameters:
im - the image
icon - if true resize to an icon
Method Detail

reset

public void reset(java.awt.Image im)
changes the image displayed on the canvas and repaints the image canvas

Parameters:
im - the image to use

reset

public void reset(java.awt.Image im,
                  int x,
                  int y)
changes the image displayed on the canvas, resizes the images, and repaints the image canvas

Parameters:
im - the image to use
x - the width to resize to
y - the height to resize to

paint

public void paint(java.awt.Graphics g)
draws the image in the canvas

Overrides:
paint in class java.awt.Canvas
Parameters:
g - the graphics context

getWidth

public int getWidth()
gets the width of the image displayed on the canvas

Overrides:
getWidth in class java.awt.Component
Returns:
the image's width

getHeight

public int getHeight()
gets the height of the image displayed on the canvas

Overrides:
getHeight in class java.awt.Component
Returns:
the image's height

update

public void update(java.awt.Graphics g)
overwrites the component updates to prevent erasing, i.e., flickering

Overrides:
update in class java.awt.Canvas