Basic HTML version of Foils prepared 13 October 97

Foil 53 AWT Component: Canvas

From Java Tutorial, July 1, 1996 CSC499(JSU) CPS406/606 -- Fall Semester 97. by Nancy J. McCracken,Geoffrey C. Fox

API for class Canvas
1 Canvas is a simple class that is used to draw on as in artist's canvas. They cannot contain other components. This is the class on which you use the graphics methods.
2 Canvases can be included as parts of other Containers. In this case, you may need to obtain a Graphics object for drawing:
  • Canvas drawcanvas;
  • Graphics drawgraphics = drawcanvas.getGraphics();
  • drawgraphics.drawString("Graph Label");

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Wed Apr 1 1998