Basic HTML version of Foils prepared Sept 21 1998

Foil 53 AWT Component: Canvas

From Java Tutorial 98- 3: Graphics and the Abstract Windowing Toolkit NAVO Tutorial -- Sept 23 1998. by Geoffrey C. Fox, Nancy McCracken

API for class Canvas
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.
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");



© 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 Sat Nov 28 1998