Project MVC architecture
version 0.1 - 010723

lib.gui
Class ImageCanvas

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--lib.gui.ImageCanvas
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable
Direct Known Subclasses:
ImageButton, ImageLabel

public class ImageCanvas
extends java.awt.Canvas
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener

Displays a gif image region and process mouse events in its display area.

The image region is an offset portion of the image displayed at the instance bounding box.

Version:
1.0 18/05/2000
Author:
Ivan Wellesz
See Also:
Serialized Form

Inner classes inherited from class java.awt.Canvas
java.awt.Canvas.AccessibleAWTCanvas
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock
 
Field Summary
protected  java.awt.Image image
          Image from which to draw a region.
protected  int regionHeight
          Region height.
protected  int regionOffsetX
          Region origin left offset.
protected  int regionOffsetY
          Region origin top offset.
protected  int regionWidth
          Region width.
 
Fields inherited from class java.awt.Canvas
base, nameCounter, serialVersionUID
 
Fields inherited from class java.awt.Component
accessibleContext, actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dbg, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, privateKey, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowListenerK, x, y
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ImageCanvas()
           
ImageCanvas(java.awt.Image image, int regionOffsetX, int imageOfsfetY, int regionWidth, int regionHeight)
           
 
Method Summary
 boolean isDoubleBuffered()
          public isDoubleBuffered - Returns true if this component is painted to an offscreen image.
 void mouseClicked(java.awt.event.MouseEvent event)
          Mouse clicked callback.
 void mouseDragged(java.awt.event.MouseEvent event)
          Mouse dragged callback.
 void mouseEntered(java.awt.event.MouseEvent event)
          Mouse entered callback.
 void mouseExited(java.awt.event.MouseEvent event)
          Mouse leaved callback.
 void mouseMoved(java.awt.event.MouseEvent event)
          Mouse motion callback.
 void mousePressed(java.awt.event.MouseEvent event)
          Mouse pressed callback.
 void mouseReleased(java.awt.event.MouseEvent event)
          Mouse released callback.
 void paint(java.awt.Graphics g)
          Draw graphics.
 void process_mouseClicked(int x, int y, int modifiers)
          Default mouse clicked callback processing.
 void process_mouseDragged(int x, int y, int modifiers)
          Default mouse dragged callback processing.
 void process_mouseEntered(int x, int y, int modifiers)
          Default mouse entered callback processing.
 void process_mouseExited(int x, int y, int modifiers)
          Default mouse leaved callback processing.
 void process_mouseMoved(int x, int y, int modifiers)
          Default mouse motion callback processing.
 void process_mousePressed(int x, int y, int modifiers)
          Default mouse pressed callback processing.
 void process_mouseReleased(int x, int y, int modifiers)
          Default mouse released callback processing.
 void update(java.awt.Graphics g)
          Update graphics.
 
Methods inherited from class java.awt.Canvas
, addNotify, constructComponentName, getAccessibleContext, postsOldMouseEvents
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkGD, checkImage, checkImage, checkWindowClosingException, coalesceEvents, contains, contains, createChildHierarchyEvents, createHierarchyEvents, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, dispatchEventImpl, doLayout, enable, enable, enableEvents, enableInputMethods, eventEnabled, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, initIDs, inside, invalidate, isDisplayable, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isRecursivelyVisible, isShowing, isValid, isVisible, keyDown, keyUp, layout, lightweightPaint, lightweightPrint, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, numListening, paintAll, paintHeavyweightComponents, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, printHeavyweightComponents, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, readObject, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, resetGC, 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, writeObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

image

protected java.awt.Image image
Image from which to draw a region.

regionOffsetX

protected int regionOffsetX
Region origin left offset.

regionOffsetY

protected int regionOffsetY
Region origin top offset.

regionWidth

protected int regionWidth
Region width.

regionHeight

protected int regionHeight
Region height.
Constructor Detail

ImageCanvas

public ImageCanvas()

ImageCanvas

public ImageCanvas(java.awt.Image image,
                   int regionOffsetX,
                   int imageOfsfetY,
                   int regionWidth,
                   int regionHeight)
Parameters:
image - image from which to draw a region
regionOffsetX - region origin left offset
regionOffsetY - region origin top offset
regionWidth - region width
regionHeight - region height
Method Detail

isDoubleBuffered

public boolean isDoubleBuffered()
public isDoubleBuffered - Returns true if this component is painted to an offscreen image. // {{{ ("buffer") that's copied to the screen later.
Overrides:
isDoubleBuffered in class java.awt.Component

update

public void update(java.awt.Graphics g)
Update graphics. Do not clear the display area when updating.
Overrides:
update in class java.awt.Component
Parameters:
g - the graphics to use for painting

paint

public void paint(java.awt.Graphics g)
Draw graphics.
Overrides:
paint in class java.awt.Canvas
Parameters:
g - the graphics to use for painting

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent event)
Mouse entered callback.
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent event)
Mouse leaved callback.
Specified by:
mouseExited in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent event)
Mouse pressed callback.
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent event)
Mouse released callback.
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent event)
Mouse clicked callback.
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent event)
Mouse dragged callback.
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent event)
Mouse motion callback.
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

process_mouseEntered

public void process_mouseEntered(int x,
                                 int y,
                                 int modifiers)
Default mouse entered callback processing.

process_mouseExited

public void process_mouseExited(int x,
                                int y,
                                int modifiers)
Default mouse leaved callback processing.

process_mousePressed

public void process_mousePressed(int x,
                                 int y,
                                 int modifiers)
Default mouse pressed callback processing.

process_mouseReleased

public void process_mouseReleased(int x,
                                  int y,
                                  int modifiers)
Default mouse released callback processing.

process_mouseClicked

public void process_mouseClicked(int x,
                                 int y,
                                 int modifiers)
Default mouse clicked callback processing.

process_mouseDragged

public void process_mouseDragged(int x,
                                 int y,
                                 int modifiers)
Default mouse dragged callback processing.

process_mouseMoved

public void process_mouseMoved(int x,
                               int y,
                               int modifiers)
Default mouse motion callback processing.

MVC architecture

Document Tech Infos - Ivan Wellesz