previous | start | next

## Float/Double Classes

    public class Rectangle2D

    {

       public static class Float extends Rectangle2D

       {

          public double getX() { return x; }

          public double getY() { return y; }

          public double getWidth() { return width; }

          public double getHeight() { return height;}

          public void setRect(float x, float y, float w, float h)

          {

             this.x = x; this.y = y;

             this.width = w; this.height = h;

          }

          public void setRect(double x, double y,

             double w, double h)

          {

             this.x = (float)x; this.y = (float)y;

             this.width = (float)w; this.height = (float)h;

          }

          ...

          public float x;

          public float y;

          public float width;

          public float height;

       }

       . . .

previous | start | next