|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
objectdraw.JDrawingCanvas
A JDrawingCanvas is a Swing GUI component designed for displaying simple graphics created by instantiating members of subclasses of the Drawable class. A similar AWTDrawingCanvas is provided to support use of the Abstract Windowing Toolkit. 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
,
AWTDrawingCanvas
,
Serialized FormNested Class Summary |
Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Field 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 javax.swing.JComponent |
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
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 | |
JDrawingCanvas()
Creates a new DrawingCanvas. |
|
JDrawingCanvas(java.awt.Dimension size)
Creates a new DrawingCanvas. |
|
JDrawingCanvas(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 |
java.awt.Dimension |
getPreferredSize()
Retrieves the object's preferred size. |
boolean |
imageUpdate(java.awt.Image img,
int infoflags,
int x,
int y,
int width,
int height)
Repaints the component when the image has changed. |
void |
paint(java.awt.Graphics g)
Paints the canvas by calling the real paint method of 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 javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateUI |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
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, getHeight, getSize, getWidth, prepareImage, requestFocus, requestFocusInWindow |
Field Detail |
public static final java.awt.Dimension DEFAULT_PREFERRED_SIZE
public final int REPAINT_DELAY
Constructor Detail |
public JDrawingCanvas()
public JDrawingCanvas(int width, int height)
width
- the canvas' preferred widthheight
- the canvas' preferred heightpublic JDrawingCanvas(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 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 observedinfoflags
- - see imageUpdate for more informationx
- - the x coordinatey
- - the y coordinatewidth
- - the widthheight
- - 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 |