objectdraw
Class FrameCanvas

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by objectdraw.JDrawingCanvas
                  extended by objectdraw.FrameCanvas
All Implemented Interfaces:
ComponentListener, WindowListener, ImageObserver, MenuContainer, Serializable, EventListener, DrawingCanvas

public class FrameCanvas
extends JDrawingCanvas
implements DrawingCanvas, ComponentListener, WindowListener

FrameCanvas is an extension of JDrawingCanvas that creates a JFrame and puts a JDrawingCanvas inside. It is provided to make it possible to experiment with creating and manipulating graphical objects on a DrawingCanvas under environments like Dr. Java and BlueJ.

Version:
1.1.1 released February 2005
See Also:
DrawingCanvas, JDrawingCanvas, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static Dimension DEFAULT_PREFERRED_SIZE
           
 
Fields inherited from class objectdraw.JDrawingCanvas
REPAINT_DELAY
 
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
accessibleContext, 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
FrameCanvas()
          Creates a new FrameCanvas.
FrameCanvas(Dimension size)
          Creates a new FrameCanvas.
FrameCanvas(int width, int height)
          Creates a new FrameCanvas.
 
Method Summary
 Dimension getPreferredSize()
          Returns the preferred size of the Frame.
 void setSize(Dimension d)
          Sets the size of the Frame to the given Dimension.
 void setSize(int width, int height)
          Sets the size of the Frame to the given width and height.
 void windowActivated(WindowEvent e)
          Empty method included to implement the WindowListener interface.
 void windowClosed(WindowEvent e)
          Empty method included to implement the WindowListener interface.
 void windowClosing(WindowEvent e)
          Closes the Frame and kills all running ActiveObjects so they don't remain alive behind the scenes.
 void windowDeactivated(WindowEvent e)
          Empty method included to implement the WindowListener interface.
 void windowDeiconified(WindowEvent e)
          Empty method included to implement the WindowListener interface.
 void windowIconified(WindowEvent e)
          Empty method included to implement the WindowListener interface.
 void windowOpened(WindowEvent e)
          Empty method included to implement the WindowListener interface.
 
Methods inherited from class objectdraw.JDrawingCanvas
clear, componentHidden, componentMoved, componentResized, componentShown, disableAutoRepaint, enableAutoRepaint, getCanvasContent, getDrawableIterator, imageUpdate, paint, repaint, update
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface objectdraw.DrawingCanvas
addComponentListener, addKeyListener, addMouseListener, addMouseMotionListener, clear, createImage, disableAutoRepaint, enableAutoRepaint, getCanvasContent, getDrawableIterator, getGraphics, getHeight, getSize, getWidth, prepareImage, repaint, requestFocus, requestFocusInWindow, setBackground, setForeground
 
Methods inherited from interface java.awt.image.ImageObserver
imageUpdate
 
Methods inherited from interface java.awt.event.ComponentListener
componentHidden, componentMoved, componentResized, componentShown
 

Field Detail

DEFAULT_PREFERRED_SIZE

public static final Dimension DEFAULT_PREFERRED_SIZE
Constructor Detail

FrameCanvas

public FrameCanvas()
Creates a new FrameCanvas.


FrameCanvas

public FrameCanvas(Dimension size)
Creates a new FrameCanvas.

Parameters:
size - the canvas' preferred dimensions

FrameCanvas

public FrameCanvas(int width,
                   int height)
Creates a new FrameCanvas.

Parameters:
width - the canvas' preferred width
height - the canvas' preferred height
Method Detail

getPreferredSize

public Dimension getPreferredSize()
Returns the preferred size of the Frame.

Overrides:
getPreferredSize in class JDrawingCanvas
Returns:
the preferred Dimension

setSize

public void setSize(Dimension d)
Sets the size of the Frame to the given Dimension.

Overrides:
setSize in class Component
Parameters:
d - the new dimension for the Frame

setSize

public void setSize(int width,
                    int height)
Sets the size of the Frame to the given width and height.

Overrides:
setSize in class Component
Parameters:
width - the new width of the Frame
height - the new height of the Frame

windowActivated

public void windowActivated(WindowEvent e)
Empty method included to implement the WindowListener interface.

Specified by:
windowActivated in interface WindowListener
Parameters:
e - an event that will be ignored

windowClosed

public void windowClosed(WindowEvent e)
Empty method included to implement the WindowListener interface.

Specified by:
windowClosed in interface WindowListener
Parameters:
e - an event that will be ignored

windowClosing

public void windowClosing(WindowEvent e)
Closes the Frame and kills all running ActiveObjects so they don't remain alive behind the scenes.

Specified by:
windowClosing in interface WindowListener
Parameters:
e - the WindowEvent telling the window to close

windowDeactivated

public void windowDeactivated(WindowEvent e)
Empty method included to implement the WindowListener interface.

Specified by:
windowDeactivated in interface WindowListener
Parameters:
e - an event that will be ignored

windowDeiconified

public void windowDeiconified(WindowEvent e)
Empty method included to implement the WindowListener interface.

Specified by:
windowDeiconified in interface WindowListener
Parameters:
e - an event that will be ignored

windowIconified

public void windowIconified(WindowEvent e)
Empty method included to implement the WindowListener interface.

Specified by:
windowIconified in interface WindowListener
Parameters:
e - an event that will be ignored

windowOpened

public void windowOpened(WindowEvent e)
Empty method included to implement the WindowListener interface.

Specified by:
windowOpened in interface WindowListener
Parameters:
e - an event that will be ignored