Diva
Home
About
Demos
Downloads
Packages
Forum
Mail lists

Canvas and panes

The main purpose of JCanvas is to provide screen real-estate and event-routing for the contained pane. It overrides several methods in JComponent to forward requests either from Swing down to the pane, or up from the pane to Swing. In the first category are methods such as paint(), setPreferredSize(), processMouseEvent(), and processMouseMotionEvent(); in the latter category are the repaint() methods.

CanvasPane is a container for a list of CanvasLayer classes. CanvasPane is abstract. All layers in a pane are "stacked" over the top of each other, with layers at the front of the display list drawn over the top of layers at the back of the display list. The CanvasPane can have one of two types of "parent": the JCanvas, which it will have if it is the top-level pane and therefore the root of the graphical display tree, and a CanvasComponent, which it will have if it is not.

Diva includes two concrete subclasses of CanvasPane -- BasicCanvasPane and GraphicsPane. BasicCanvasPane allows layers to be added to itself. It is intended mainly as a "starter" class, and for use with simple demos and the like. GraphicsPane is intended for use in typical interactive applications. It contains five layers: a background event layer, a background figure layer, a foreground figure layer, an overlay layer, and a foreground event layer. By default, a JCanvas contains an instance of GraphicsPane.


Top: The Diva Canvas Design Reference Previous: JCanvas architecture Up: The JCanvas architecture Next: Layers

Send feedback to cxh at eecs berkeley edu
Contact 
©2002-2018 U.C. Regents