int dy = y1 - y0; int dx = x1 - x0; int stepx, stepy;  if (dy < 0) { dy = -dy; stepy = -1;
draw(new Line2D.Float(x0, y0, x1, y1));
  protected void rawDrawLine(int x0, int y0, int x1, int y1)  {    // This is an implementation of Bresenham's line drawing algorithm.    int dy = y1 - y0;    int dx = x1 - x0;    int stepx, stepy;    if (dy < 0)      {        dy = -dy;        stepy = -1;      }    else      {        stepy = 1;      }    if (dx < 0)      {        dx = -dx;        stepx = -1;        }    else      {        stepx = 1;      }    dy <<= 1;    dx <<= 1;    drawPixel(x0, y0);    if (dx > dy)      {        int fraction = dy - (dx >> 1); // same as 2*dy - dx        while (x0 != x1)          {            if (fraction >= 0)              {                y0 += stepy;                fraction -= dx;              }            x0 += stepx;            fraction += dy;            drawPixel(x0, y0);          }      }    else      {        int fraction = dx - (dy >> 1);        while (y0 != y1)          {            if (fraction >= 0)              {                x0 += stepx;                fraction -= dy;              }            y0 += stepy;            fraction += dx;            drawPixel(x0, y0);          }      }  }