HELP! * GREY=local LOCAL HTML version of Foils prepared January 8,96

Foil 36 Declaration of Class Canvas:

From Overview of Java SC95 Tutorial on Web Technologies -- December 4,95. by NPAC Team * See also color IMAGE

import awt.Color;
import awt.Graphics;
public class Canvas extends Rectangle implements Movable
{ Color fg, bg;
public Canvas(float x1, float y1, float x2, float y2, Color fg, Color bg) {
  • super(x1,y1,x2,y2);
  • this.fg = fg;
  • this.bg = bg; }
public void inverse() {
  • super.inverse();
  • Color tmp = fg;
  • fb = bg;
  • bg = tmp; }
public void paint(Graphics g) {
  • g.setColor(bg);
  • g.fillRect(p.x, p.y, w, h); }
} // end class Canvas



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 Tue Feb 18 1997