The tutorial window

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.


Top: The Diva Canvas Tutorial Next: Basic tutorials