|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Canvas
|
+--ach.ImgCanvas
ImgCanvas.java
Copyright (c) 1999-2002 Helge Hackbarth, All Rights Reserved.
Extends Canvas with comfortable image display functions and automatic
drawing of background patterns. This component is heavyweight.
In order to use the same functionality but as lightweight component
e.g. for a JInternalFrame please use class ImgComponent.
THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY
OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, OR NON-INFRINGEMENT. THE AUTHOR SHALL NOT BE LIABLE FOR ANY
DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
| Inner classes inherited from class java.awt.Canvas |
java.awt.Canvas.AccessibleAWTCanvas |
| Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent |
| Field Summary | |
boolean |
clearBackground
Flag if background is simply cleared or drawn with a black-and-white pattern |
boolean |
clearBeforePaint
Flag if canvas needs to be cleared before paint. |
boolean |
needsFocus
Flag if canvas needs to request focus (e.g. in order to receive events in JDK 1.0). |
| 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 | |
ImgCanvas(java.awt.Container parent)
constructor for ImgCanvas |
|
ImgCanvas(java.awt.Container parent,
java.awt.image.ImageObserver observer)
constructor for ImgCanvas chaining to additional image observer |
|
| Method Summary | |
void |
checkFocus()
request focus if boolean var needsFocus is set true |
void |
drawError(java.lang.String errorMsg)
schedule a repaint that will draw an error messages (may contain \r\n) |
void |
drawImage(java.awt.Image img,
int x,
int y)
schedule a repaint with drawing the given image (not scaled) |
void |
drawImage(java.awt.Image img,
int x,
int y,
int width,
int height,
int hints)
schedule a repaint with drawing the given image (scaled) |
void |
drawShapes(ShapeList sl)
draw vector graphics objects |
void |
fitInImage(java.awt.Image img,
java.awt.Dimension imgDim,
int hints)
schedule a repaint with an image proportionally scaled to fit in canvas |
boolean |
getDoubleBuffering()
Retrieve current setting of double buffering mode |
java.awt.Image |
getOffscreen()
Get offscreen image |
boolean |
imageUpdate(java.awt.Image img,
int flags,
int x,
int y,
int w,
int h)
Image canvas is a modified ImageObserver to retry after ABORT and to be able to chain in another ImageObserver |
void |
paint(java.awt.Graphics g)
the paint method of the image canvas |
void |
requestFocus()
|
void |
resize(java.awt.Dimension d)
|
void |
resize(int width,
int height)
|
void |
setBackground(java.awt.Color c)
|
void |
setBackgroundExclusion(int x,
int y,
int width,
int height)
Specify the area that has to be excluded from drawing the background |
void |
setDoubleBuffering(boolean dblBufMode)
Enable or disable double buffering when component is painted |
void |
setSize(java.awt.Dimension d)
|
void |
setSize(int width,
int height)
|
void |
update(java.awt.Graphics g)
the update method of the image canvas (calling paint()); drawing of the background is controlled by clearBeforePaint-flag |
| Methods inherited from class java.awt.Canvas |
addNotify, getAccessibleContext |
| Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, 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, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getPreferredSize, 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, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, reshape, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setVisible, show, show, size, toString, transferFocus, validate |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public boolean needsFocus
public boolean clearBeforePaint
public boolean clearBackground
| Constructor Detail |
public ImgCanvas(java.awt.Container parent)
parent - is the container where this canvas is to be embedded
public ImgCanvas(java.awt.Container parent,
java.awt.image.ImageObserver observer)
parent - is the container where this canvas is to be embeddedobserver - additional image observer to be chained in at drawImage| Method Detail |
public void setDoubleBuffering(boolean dblBufMode)
setDoubleBuffering in interface ImgComponentIntfdblBufMode - true to enable double buffering, false otherwisepublic boolean getDoubleBuffering()
getDoubleBuffering in interface ImgComponentIntfpublic java.awt.Image getOffscreen()
getOffscreen in interface ImgComponentIntfpublic void resize(java.awt.Dimension d)
resize in interface ImgComponentIntfresize in class java.awt.Component
public void resize(int width,
int height)
resize in interface ImgComponentIntfresize in class java.awt.Componentpublic void setSize(java.awt.Dimension d)
setSize in interface ImgComponentIntfsetSize in class java.awt.Component
public void setSize(int width,
int height)
setSize in interface ImgComponentIntfsetSize in class java.awt.Componentpublic void setBackground(java.awt.Color c)
setBackground in interface ImgComponentIntfsetBackground in class java.awt.Component
public void setBackgroundExclusion(int x,
int y,
int width,
int height)
setBackgroundExclusion in interface ImgComponentIntfx - the X-coordinate of the excluded areay - the Y-coordinate of the excluded areawidth - the width of the excluded areaheight - the height of the excluded areapublic void checkFocus()
ImgComponentIntfcheckFocus in interface ImgComponentIntf
public void drawImage(java.awt.Image img,
int x,
int y,
int width,
int height,
int hints)
drawImage in interface ImgComponentIntfimg - the image to be drawnx - the X-coordinate of the image relative to canvasy - the Y-coordinate of the image relative to canvaswidth - the scaled width of the imageheight - the scaled height of the imagehints - options for scaling method, see getScaledInstance (e.g. SCALE_SMOOTH)Image.getScaledInstance(int width, int height, int hints)
public void drawImage(java.awt.Image img,
int x,
int y)
drawImage in interface ImgComponentIntfimg - the image to be drawnx - the X-coordinate of the image relative to canvasy - the Y-coordinate of the image relative to canvas
public void fitInImage(java.awt.Image img,
java.awt.Dimension imgDim,
int hints)
fitInImage in interface ImgComponentIntfimg - the image to be drawnimgDim - the size of the imagehints - options for scaling method, see getScaledInstance (e.g. SCALE_SMOOTH)Image.getScaledInstance(int width, int height, int hints)public void drawError(java.lang.String errorMsg)
drawError in interface ImgComponentIntferrorMsg - the error messagepublic void drawShapes(ShapeList sl)
drawShapes in interface ImgComponentIntfShapeList - containing vector graphics (e.g. annotations)public void requestFocus()
requestFocus in class java.awt.Componentpublic void paint(java.awt.Graphics g)
paint in interface ImgComponentIntfpaint in class java.awt.Canvaspublic void update(java.awt.Graphics g)
update in interface ImgComponentIntfupdate in class java.awt.Component
public boolean imageUpdate(java.awt.Image img,
int flags,
int x,
int y,
int w,
int h)
imageUpdate in interface ImgComponentIntfimageUpdate in class java.awt.Component
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||