scenic
Class ScenicCanvas

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Canvas
          extended by scenic.jni.RenderCanvas
              extended by scenic.ScenicCanvas
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class ScenicCanvas
extends scenic.jni.RenderCanvas

This component is used to display scene graphs. Users of the Scenic library should extend this class and override the updateScene() method to create graphics. All changes to the scene graph should be done in the updateScene() method. Never call updateScene() directly. Instead, you should call the invalidateScene() method.

See Also:
Serialized Form

Field Summary
 
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
ScenicCanvas()
          Creates an empty ScenicCanvas.
 
Method Summary
 void childChanged(java.awt.Rectangle area)
          This method is automatically called when the scene graph is changed.
 SceneNode getScene()
          Gets the scene.
 void invalidateScene()
          Invalidates the scene.
 boolean isShowStatistics()
          Gets whatever statistics are shown or not.
 void paint(java.awt.Graphics g)
          Paints the component.
 void setBackground(ScenicColor color)
          Sets the background color of the canvas.
 void setScene(SceneNode scene)
          Sets the scene.
 void setShowStatistics(boolean showStatistics)
          Sets whatever statistics are shown or not.
 void updateScene()
          Updates the scene.
 
Methods inherited from class scenic.jni.RenderCanvas
addNotify, finalize, getContext, getIsIntialized, release, update
 
Methods inherited from class java.awt.Canvas
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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, 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, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, 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
 

Constructor Detail

ScenicCanvas

public ScenicCanvas()
Creates an empty ScenicCanvas.

Method Detail

setBackground

public void setBackground(ScenicColor color)
Sets the background color of the canvas.


isShowStatistics

public boolean isShowStatistics()
Gets whatever statistics are shown or not.


setShowStatistics

public void setShowStatistics(boolean showStatistics)
Sets whatever statistics are shown or not.


setScene

public void setScene(SceneNode scene)
Sets the scene.


getScene

public SceneNode getScene()
Gets the scene.


paint

public void paint(java.awt.Graphics g)
Paints the component. This method calls the updateScene() method before rendering the scene if the scene has been invalidated.

Overrides:
paint in class scenic.jni.RenderCanvas

invalidateScene

public void invalidateScene()
Invalidates the scene. This method marks the scene as invalidated and calls the repaint() to ask AWT to paint the component. When the component is painted the paint() method calls the updateScene() method.


updateScene

public void updateScene()
Updates the scene. This method should be overriden by classes that extends this class. This method should be responsible for updating and modifying the scene.


childChanged

public void childChanged(java.awt.Rectangle area)
This method is automatically called when the scene graph is changed. Do not call this method yourself. The scene is automatically repainted whenever it changes.