JIU 0.14.3

net.sourceforge.jiu.gui.awt
Class ImageCanvas

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Canvas
          extended by net.sourceforge.jiu.gui.awt.ImageCanvas
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class ImageCanvas
extends Canvas

An AWT canvas that displays an Image object. Capable to display at arbitrary zooming levels. Does not use rendering hints because they require Java 1.2 or higher (although bilinear and bicubic interpolation usually improve display quality when zooming at the cost of slowing down image drawing).

Author:
Marco Schmidt
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Canvas
Canvas.AccessibleAWTCanvas
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
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(ScrollPane scrollPane)
           
 
Method Summary
 void computeZoomToFitSize()
           
 Dimension getPreferredSize()
           
 double getZoomFactorX()
           
 double getZoomFactorY()
           
 int getZoomPercentageX()
           
 int getZoomPercentageY()
           
 void paint(Graphics g)
          Draws image to upper left corner.
 void setImage(Image newImage)
          Specifies a new Image object to be displayed in this canvas.
 void setInterpolation(int newType)
          Sets the interpolation type used for drawing to the argument (must be one of the INTERPOLATION_xyz constants of EditorState), but does not do a redraw.
 void setOriginalSize()
          Sets both zoom factors to 1.0.
 void setZoomFactor(double newZoomFactor)
           
 void setZoomFactors(double newZoomFactorX, double newZoomFactorY)
           
 void setZoomToFit(boolean newValue)
           
 void update(Graphics g)
          Simply calls paint(Graphics) with the argument.
 
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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, 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, getMousePosition, 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, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, 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, setMaximumSize, setMinimumSize, setName, setPreferredSize, 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(ScrollPane scrollPane)
Method Detail

computeZoomToFitSize

public void computeZoomToFitSize()

getZoomPercentageX

public int getZoomPercentageX()

getZoomPercentageY

public int getZoomPercentageY()

getPreferredSize

public Dimension getPreferredSize()
Overrides:
getPreferredSize in class Component

paint

public void paint(Graphics g)
Draws image to upper left corner.

Overrides:
paint in class Canvas

setImage

public void setImage(Image newImage)
Specifies a new Image object to be displayed in this canvas.

Parameters:
newImage - the new Image object, potentially null

setOriginalSize

public void setOriginalSize()
Sets both zoom factors to 1.0.


getZoomFactorX

public double getZoomFactorX()

getZoomFactorY

public double getZoomFactorY()

setInterpolation

public void setInterpolation(int newType)
Sets the interpolation type used for drawing to the argument (must be one of the INTERPOLATION_xyz constants of EditorState), but does not do a redraw.


setZoomFactor

public void setZoomFactor(double newZoomFactor)

setZoomFactors

public void setZoomFactors(double newZoomFactorX,
                           double newZoomFactorY)

setZoomToFit

public void setZoomToFit(boolean newValue)

update

public void update(Graphics g)
Simply calls paint(Graphics) with the argument.

Overrides:
update in class Canvas
Parameters:
g - Graphics context

JIU 0.14.3

Copyright © 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Marco Schmidt