if (tileIcon == null) return;
  private void paintEdge(Component c, Graphics g,                         int x, int y, int width, int height,                         int dx, int dy)  {    Color oldColor;    int iconWidth, iconHeight;    Graphics clipped;    if ((width <= 0) || (height <= 0))      return;    /* Paint a colored rectangle if desired. */    if (color != null)    {      oldColor = g.getColor();      try      {        g.setColor(color);        g.fillRect(x, y, width, height);      }      finally      {        g.setColor(oldColor);      }      return;    }    /* Determine the width and height of the icon. Some icons return     * -1 if it is an image whose dimensions have not yet been     * retrieved. There is not much we can do about this, but we     * should at least avoid entering the paint loop below     * with negative increments.     */    iconWidth = tileIcon.getIconWidth();    iconHeight = tileIcon.getIconHeight();    if ((iconWidth <= 0) || (iconHeight <= 0))      return;    dx = dx % iconWidth;    dy = dy % iconHeight;    clipped = g.create();    try    {      clipped.setClip(x, y, width, height);      for (int ty = y - dy; ty < y + height; ty += iconHeight)        for (int tx = x - dx; tx < x + width; tx += iconWidth)          tileIcon.paintIcon(c, clipped, tx, ty);    }    finally    {      clipped.dispose();    }  }