com.rolemodelsoft.drawlet.awt
Class DrawingCanvasComponent

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--com.rolemodelsoft.drawlet.awt.DrawingCanvasComponent
Direct Known Subclasses:
BufferedDrawingCanvasComponent

public class DrawingCanvasComponent
extends java.awt.Canvas

This provides basic functionality necessary to provide a meaningful working version of a DrawingCanvas that can be tied to a Component in an AWT Application. It is expected that this would serve as the base for these sort of Components, but not required.

See Also:
Serialized Form

Field Summary
protected  DrawingCanvas canvas
          The drawing canvas we are displaying/manipulating.
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
DrawingCanvasComponent()
          Create a default DrawingCanvasComponent.
DrawingCanvasComponent(DrawingCanvas canvas)
          Constructs a new DrawingCanvasComponent, associating it with the given DrawingCanvas
 
Method Summary
 DrawingCanvas getCanvas()
           
 java.awt.Dimension getPreferredSize()
          Gets the preferred size of the receiver.
 boolean isFocusTraversable()
          Tell the AWT I am able to receive the focus.
 void paint(java.awt.Graphics g)
          Paints the receiver.
 void repaint(java.awt.Rectangle rectangle)
          Repaints part of the receiver.
protected  void setCanvas(DrawingCanvas canvas)
          Set the DrawingCanvas the receiver is associated with.
 
Methods inherited from class java.awt.Canvas
addNotify
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, 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, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, 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, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

canvas

protected DrawingCanvas canvas
The drawing canvas we are displaying/manipulating.
Constructor Detail

DrawingCanvasComponent

public DrawingCanvasComponent()
Create a default DrawingCanvasComponent.

DrawingCanvasComponent

public DrawingCanvasComponent(DrawingCanvas canvas)
Constructs a new DrawingCanvasComponent, associating it with the given DrawingCanvas
Parameters:
canvas - the canvas this component will be associated with.
Method Detail

getCanvas

public DrawingCanvas getCanvas()
Returns:
the DrawingCanvas we are drawing/manipulating

getPreferredSize

public java.awt.Dimension getPreferredSize()
Gets the preferred size of the receiver.
Overrides:
getPreferredSize in class java.awt.Component
Returns:
a dimension object indicating the receiver's preferred size.

isFocusTraversable

public boolean isFocusTraversable()
Tell the AWT I am able to receive the focus.
Overrides:
isFocusTraversable in class java.awt.Component
Returns:
boolean value of true if the receiver is focus traversable; false otherwise.

paint

public void paint(java.awt.Graphics g)
Paints the receiver.
Overrides:
paint in class java.awt.Canvas
Parameters:
g - the specified Graphics window

repaint

public void repaint(java.awt.Rectangle rectangle)
Repaints part of the receiver. This will result in a call to update as soon as possible.
Parameters:
rectangle - is the region to be repainted

setCanvas

protected void setCanvas(DrawingCanvas canvas)
Set the DrawingCanvas the receiver is associated with.
Parameters:
canvas - the DrawingCanvas we should draw/manipulate