Package diva.canvas.tutorial

A set of tutorials for the Diva canvas.

See:
          Description

Class Summary
ArcTutorial This tutorial shows how to use "arc" connectors.
ArcTutorial.SelfPTarget SelfPTarget is used to find target sites.
CompositeFigureTutorial This tutorial demonstrates how to use composite figures.
ConnectorTutorial This tutorial shows how to use Connectors.
ConnectorTutorial.SitedRectangle SitedRectangle is a class that provides four sites that we use in the examples to attach connectors to.
ConnectorTutorial.SRTarget SRTarget is used to find a useful site on a SitedRectangle.
DragTutorial An example showing how to make figures draggable with interactors.
FigureTutorial An example showing how to make custom figures.
FigureTutorial.CustomRectangle CustomRectangle is a class that paints itself as a rectangle and draw a red plus sign over the top of itself.
IconTutorial This tutorial illustrates how to use Icons.
LabelTutorial This tutorial illustrates how to use LabelFigure and related classes.
ManipulatorTutorial This tutorial shows how to add different types of manipulators to figures.
SimpleTutorial This tutorial shows how to construct a JCanvas and place figures on it.
TerminalTutorial This tutorial illustrates how to use Terminals.
TransformedFigureTutorial This tutorial shows how to make custom figures that contain their own TransformContext.
TransformedFigureTutorial.CloudFigure CloudFigure is a class that paints itself as a translucent "cloud."
VectorFigureTutorial An example showing how to use VectorFigure.
 

Package diva.canvas.tutorial Description

A set of tutorials for the Diva canvas. Each class in this package illustrates how to use one key aspect of the canvas. Each class is self-contained, so that you can see all of the code in one place, and as short as possible given the constraints of making them somewhat realistic. The classes are further broken into small methods, each illustrating one key point.

All of the tutorials show some common code in the constructor that creates an instance of JCanvas and places it into a frame. The code is:

  canvas = new JCanvas();
  graphicsPane = (GraphicsPane)canvas.getCanvasPane();

  BasicFrame frame = new BasicFrame("Simple canvas tutorial", canvas);
  frame.setSize(600,400);
  frame.setVisible(true);

(Where canvas and graphicsPane are private variables of the class.) Every JCanvas contains a top-level canvas pane, which in turn contains layers. By default, the top-level pane is an instance of GraphicsPane. BasicFrame is part of the diva.gui package and contains the JCanvas in its content pane.

To run a particular tutorial, simply move to the diva/canvas/tutorial directory and type:

  make FigureTutorial
(where FigureTutorial is replaced by the class you want to run). A Java window will appear where you can see and manipulate the figures.

For a slightly larger example, see the package diva.canvas.demo.