|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Canvas
objectdraw.AWTDrawingCanvas
An AWTDrawingCanvas is an AWT GUI component designed for displaying simple graphics created by constructing Lines, FilledOvals, FilledRects, or any of the other objectdraw classes that implement DrawableInterface. A similar JDrawingCanvas is provided to support use of Swing. Both of these classes implement the DrawingCanvas interface and delegate most of the work of maintaining a description of the graphics being displayed to an object of the CanvasManager class.
DrawingCanvas
,
JDrawingCanvas
,
Serialized FormField Summary | |
static java.awt.Dimension |
DEFAULT_PREFERRED_SIZE
default size for a JDrawingCanvas |
int |
REPAINT_DELAY
The amount by which repaint requests should be delayed |
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 | |
AWTDrawingCanvas()
Creates a new DrawingCanvas. |
|
AWTDrawingCanvas(java.awt.Dimension size)
Creates a new DrawingCanvas. |
|
AWTDrawingCanvas(int width,
int height)
Creates a new DrawingCanvas. |
Method Summary | |
void |
clear()
Removes all objects from the DrawingCanvas. |
void |
componentHidden(java.awt.event.ComponentEvent e)
Invoked when component has been hidden. |
void |
componentMoved(java.awt.event.ComponentEvent e)
Invoked when component has been moved. |
void |
componentResized(java.awt.event.ComponentEvent e)
Invoked when component has been resized. |
void |
componentShown(java.awt.event.ComponentEvent e)
Invoked when component has been shown. |
void |
disableAutoRepaint()
Requests that the DrawingCanvas not be automatically repainted after every change. |
void |
enableAutoRepaint()
Requests that the DrawingCanvas to be automatically repainted after every change without specifically calling repaint() . |
objectdraw.CanvasManager |
getCanvasContent()
Retrieves the CanvasManager that keeps track of all of the Drawable objects currently associated with this DrawingCanvas. |
DrawableIterator |
getDrawableIterator()
Creates and returns an iterator of all the objects on the DrawingCanvas |
int |
getHeight()
Determine the current height of a DrawingCanvas. |
java.awt.Dimension |
getPreferredSize()
Retrieves the drawing canvas' preferred size. |
int |
getWidth()
Determine the current width of a DrawingCanvas. |
boolean |
imageUpdate(java.awt.Image img,
int infoflags,
int x,
int y,
int width,
int height)
Notifies the CanvasManager of a change in the state of an image being loaded and then calls the native java method imageUpdate. |
void |
paint(java.awt.Graphics g)
Paints the canvas by calling the real paint method in the CanvasManager |
void |
repaint()
Requests that the contents of the canvas be redrawn. |
void |
update(java.awt.Graphics g)
Paints the canvas. |
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, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getX, getY, gotFocus, handleEvent, hasFocus, hide, 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, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, 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 |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface objectdraw.DrawingCanvas |
addComponentListener, addKeyListener, addMouseListener, addMouseMotionListener, createImage, getGraphics, getSize, prepareImage, requestFocus, requestFocusInWindow |
Field Detail |
public static final java.awt.Dimension DEFAULT_PREFERRED_SIZE
public final int REPAINT_DELAY
Constructor Detail |
public AWTDrawingCanvas()
public AWTDrawingCanvas(int width, int height)
width
- the canvas' preferred widthheight
- the canvas' preferred heightpublic AWTDrawingCanvas(java.awt.Dimension size)
size
- the canvas' preferred dimensionsMethod Detail |
public objectdraw.CanvasManager getCanvasContent()
DrawingCanvas
getCanvasContent
in interface DrawingCanvas
public java.awt.Dimension getPreferredSize()
public void repaint()
DrawingCanvas
disableAutoRepaint()
has been invoked.
In its default state, a DrawingCanvas redraws the display
automatically after any change occurs.
repaint
in interface DrawingCanvas
public void clear()
DrawingCanvas
clear
in interface DrawingCanvas
public void paint(java.awt.Graphics g)
g
- the canvas' graphics context.public void update(java.awt.Graphics g)
g
- the canvas' graphics contextpublic void enableAutoRepaint()
DrawingCanvas
repaint()
. This is
the default setting.
enableAutoRepaint
in interface DrawingCanvas
public void disableAutoRepaint()
DrawingCanvas
repaint()
must be made in order to see changes made to
the objects displayed on the DrawingCanvas. By default, auto-repaint is enabled
in a newly constructed DrawingCanvas.
disableAutoRepaint
in interface DrawingCanvas
public int getWidth()
DrawingCanvas
getWidth
in interface DrawingCanvas
public int getHeight()
DrawingCanvas
getHeight
in interface DrawingCanvas
public void componentResized(java.awt.event.ComponentEvent e)
componentResized
in interface java.awt.event.ComponentListener
e
- event triggered by resizingpublic void componentMoved(java.awt.event.ComponentEvent e)
componentMoved
in interface java.awt.event.ComponentListener
e
- event triggered by movingpublic void componentShown(java.awt.event.ComponentEvent e)
componentShown
in interface java.awt.event.ComponentListener
e
- event triggered by showingpublic void componentHidden(java.awt.event.ComponentEvent e)
componentHidden
in interface java.awt.event.ComponentListener
e
- event triggered by hidingpublic boolean imageUpdate(java.awt.Image img, int infoflags, int x, int y, int width, int height)
imageUpdate
in interface java.awt.image.ImageObserver
img
- the image being observed.infoflags
- - see Sun documentation for more information.x
- - the x coordinate.y
- - the y coordinate.width
- - the width.height
- - the height.
public DrawableIterator getDrawableIterator()
DrawingCanvas
getDrawableIterator
in interface DrawingCanvas
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |