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

Foil 35 Declaration of Class Rectangle:

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

public class Rectangle implements Movable
{
Point p;
float w, h;
public Rectangle(float x1, float y1, float x2, float y2) {
  • float xmin = min(x1,x2); xmax = max(x1,x2);
  • float ymin = min(y1,y2); ymax = max(y1.y2);
  • w = xmax - xmin;
  • h = ymax - ymin;
  • p = new Point(xmin,ymin); }
  • public Rectangle() {
  • w = h = 1.0;
  • p = new Point(); }
  • public void inverse() {
  • float tmp = p.x; p.x = p.y; p.y tmp; }
  • public void move(float dx, float dy) {
  • p.move(dx,dy); }
  • public void move() {p.move();}
} // end class Rectangle



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